svgSprite.ts 458 B

1234567891011121314151617
  1. /**
  2. * Vite Plugin for fast creating SVG sprites.
  3. * https://github.com/anncwb/vite-plugin-svg-icons
  4. */
  5. import SvgIconsPlugin from 'vite-plugin-svg-icons';
  6. import path from 'path';
  7. export function configSvgIconsPlugin(isBuild: boolean) {
  8. const svgIconsPlugin = SvgIconsPlugin({
  9. iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
  10. svgoOptions: isBuild,
  11. // default
  12. symbolId: 'icon-[dir]-[name]',
  13. });
  14. return svgIconsPlugin;
  15. }