You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SVGInject is the right choice when you want to **style SVGs with CSS without changing your build pipeline** — especially for multi-framework projects, CMS-driven content, or plain HTML sites.
56
-
57
-
If your project is 100% React and you want compile-time SVG-to-component conversion, [svgr](https://react-svgr.com/) is a great alternative.
42
+
## When to use SVGInject
43
+
44
+
SVGInject works best when you don't have a build step — or don't want one for your SVGs:
45
+
46
+
-**WordPress, CMS, static sites** — add a `<script>` tag, done
47
+
-**Server-rendered pages** — PHP, Rails, Django, any backend template
48
+
-**Dynamic / third-party content** — HTML injected at runtime, CMS editors, widgets
49
+
-**Prototyping** — style SVGs with CSS without setting up tooling
50
+
-**Multi-framework projects** — one solution across jQuery, React, vanilla, whatever
51
+
52
+
SVGInject is a runtime library. It loads and injects SVGs in the browser. No build step, no bundler, no Node.js required.
53
+
54
+
**What about React, Vue, Svelte?**
55
+
SVGInject works in frameworks too (see [examples below](#frameworks)), but if your project is fully React or Vue, consider framework-native tools like [svgr](https://react-svgr.com/) or [react-inlinesvg](https://github.com/gilbarbara/react-inlinesvg) — they integrate deeper with the component lifecycle (loading states, cleanup, re-rendering).
0 commit comments