grasscutterTools/config/vite/plugins/svgIcons.ts
2022-05-02 18:38:10 +08:00

17 lines
462 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @name SvgIconsPlugin
* @description 加载SVG文件自动引入
*/
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import path from 'path'
export const ConfigSvgIconsPlugin = (isBuild: boolean) => {
return createSvgIconsPlugin({
// 指定需要缓存的图标文件夹
iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
// 指定symbolId格式
symbolId: 'icon-[dir]-[name]',
svgoOptions: isBuild,
})
}