svg-icon.ts 373 B

12345678910
  1. import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
  2. export default (path: any, isBuild: boolean) => {
  3. return createSvgIconsPlugin({
  4. // 指定需要缓存的图标文件夹
  5. iconDirs: [path.resolve(path.resolve(__dirname, '../../src'), 'assets/icons/svg')],
  6. // 指定symbolId格式
  7. symbolId: 'icon-[dir]-[name]',
  8. svgoOptions: isBuild
  9. });
  10. };