Skip to content

tangllty/vite-plugin-svg

Repository files navigation

vite-plugin-svg

A lightweight Vite 5 plugin for SVG sprites.

install

npm install @tangllty/vite-plugin-svg -D
# or
yarn add @tangllty/vite-plugin-svg -D
# or
pnpm install @tangllty/vite-plugin-svg -D

Usage

  • 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.

Contributing

If you have any questions, suggestions, or find bugs, please submit an Issues or provide a Pull Request to help improve the project.

License

vite-plugin-svg uses the MIT license. For more details, please refer to LICENSE files.

Discussion Group

  • WeChat

    • WeChat
  • Telegram

    • Telegram
  • QQ

    • QQ