A lightweight Vite 5 plugin for SVG sprites.
npm install @tangllty/vite-plugin-svg -D
# or
yarn add @tangllty/vite-plugin-svg -D
# or
pnpm install @tangllty/vite-plugin-svg -D
- Configuration plugin in vite.config.ts
import { svgIconsPlugin } from '@tangllty/vite-plugin-svg'
export default defineConfig({
plugins: [
svgIconsPlugin({
pattern: 'src/assets/icons/**/*.svg',
prefix: 'icon'
})
]
})
- Using in component please see SvgIcon.
If you have any questions, suggestions, or find bugs, please submit an Issues or provide a Pull Request to help improve the project.
vite-plugin-svg uses the MIT license. For more details, please refer to LICENSE files.