vite-svg-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

vite-svg-plugin

transfer svg file to svg symbol in vite

Install

npm install vite-svg-plugin -D

quick start

// vite.config.js / vite.config.ts
import { svgBuilder } from 'vite-svg-plugin'

export default {
  plugins: [
    svgBuilder({ path: 'your svg files directory path', prefix: '' })
  ]
}

use svg to import

<svg class="svg-icon" aria-hidden="true" v-on="$attrs">
  <use xlink:href="iconName" />
</svg>

if you set prefix, the iconName is #${prefix}-${svgFileName}. if not, the iconName is #${svgFileName}.

you can check the examples to know the detail.

config

you can check /src/type.ts to see the option.

Package Sidebar

Install

npm i vite-svg-plugin

Weekly Downloads

232

Version

1.0.4

License

MIT

Unpacked Size

14.8 kB

Total Files

18

Last publish

Collaborators

  • lstmxx