mirror of
https://github.com/xiangshu233/vue3-vant4-mobile.git
synced 2025-04-05 06:22:45 +08:00
20 lines
549 B
TypeScript
20 lines
549 B
TypeScript
/**
|
|
* Vite Plugin for fast creating SVG sprites.
|
|
* https://github.com/anncwb/vite-plugin-svg-icons
|
|
*/
|
|
|
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
|
import path from 'path';
|
|
|
|
export function configSvgIconsPlugin(isBuild: boolean) {
|
|
// 指定需要缓存的图标文件夹
|
|
const svgIconsPlugin = createSvgIconsPlugin({
|
|
iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
|
|
// 是否压缩
|
|
svgoOptions: isBuild,
|
|
// 指定symbolId格式
|
|
symbolId: 'icon-[dir]-[name]',
|
|
});
|
|
return svgIconsPlugin;
|
|
}
|