Skip to content

Commit 8dec01f

Browse files
committed
feat: 通过 svgo 自动移除 svg fill 属性
1 parent 23f5dc9 commit 8dec01f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

vite.config.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,19 @@ export default defineConfig(({ mode }) => {
9292
// 生成 SVG 雪碧图
9393
createSvgIconsPlugin({
9494
iconDirs: [resolve(root, "src/assets/icons")],
95-
symbolId: "icon-[dir]-[name]"
95+
symbolId: "icon-[dir]-[name]",
96+
// 自定义 SVGO 配置
97+
svgoOptions: {
98+
plugins: [
99+
// 移除 fill 属性
100+
{
101+
name: "removeAttrs",
102+
params: {
103+
attrs: "fill"
104+
}
105+
}
106+
]
107+
}
96108
}),
97109
// 原子化 CSS
98110
UnoCSS()

0 commit comments

Comments
 (0)