https://github.com/neki-dev/vite-plugin-svg-inject
⚙️ Inject SVG content into components
https://github.com/neki-dev/vite-plugin-svg-inject
icon inject solid svg vite
Last synced: about 1 year ago
JSON representation
⚙️ Inject SVG content into components
- Host: GitHub
- URL: https://github.com/neki-dev/vite-plugin-svg-inject
- Owner: neki-dev
- License: mit
- Created: 2022-04-04T21:13:26.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-09T16:59:07.000Z (over 3 years ago)
- Last Synced: 2024-05-30T16:45:03.818Z (about 2 years ago)
- Topics: icon, inject, solid, svg, vite
- Language: JavaScript
- Homepage:
- Size: 68.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### ⛔ Package is deprecated
Please, use [vite-plugin-svgr](https://www.npmjs.com/package/vite-plugin-svgr)
.
## ⚙️ Vite plugin SVG inject
[](https://npmjs.com/package/vite-plugin-svg-inject)
[](https://github.com/neki-dev/vite-plugin-svg-inject/blob/master/src/index.js)
Inject SVG content into components
.
* ### Install
```sh
npm i vite-plugin-svg-inject -D
```
* ### Configure
```js
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
```js
import MyIcon from './images/icon.svg';
function MyComponent() {
return (
);
}
```