Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 12 days 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 (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-09T16:59:07.000Z (almost 2 years ago)
- Last Synced: 2024-05-30T16:45:03.818Z (7 months 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
## ⚙️ Vite plugin SVG inject
[![Npm package version](https://badgen.net/npm/v/vite-plugin-svg-inject)](https://npmjs.com/package/vite-plugin-svg-inject)
[![Small size](https://img.badgesize.io/neki-dev/vite-plugin-svg-inject/master/src/index.js)](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 (
);
}
```