1.2.0 • Published 4 months ago
vite-plugin-svg-inject v1.2.0
⚙️ Vite plugin SVG inject
Inject SVG content into components
.
Install
npm i vite-plugin-svg-inject -D
Configure
import { defineConfig } from "vite";
import SVGInjectPlugin from "vite-plugin-svg-inject";
export default defineConfig({
plugins: [
// Target:
// - "react" - If JSX library is React
// - "other" (default) - For others libraries
SVGInjectPlugin(target)
],
})
Example
import MyIcon from './images/icon.svg';
function MyComponent() {
return (
<div>
<MyIcon width="32" fill="red" />
</div>
);
}