From 8dec01f0115f766d7258e57dca68f5f359fd55ce Mon Sep 17 00:00:00 2001 From: pany <939630029@qq.com> Date: Fri, 22 Nov 2024 16:50:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=80=9A=E8=BF=87=20svgo=20=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=A7=BB=E9=99=A4=20svg=20fill=20=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index 081aa85d..1341ed2c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -92,7 +92,19 @@ export default defineConfig(({ mode }) => { // 生成 SVG 雪碧图 createSvgIconsPlugin({ iconDirs: [resolve(root, "src/assets/icons")], - symbolId: "icon-[dir]-[name]" + symbolId: "icon-[dir]-[name]", + // 自定义 SVGO 配置 + svgoOptions: { + plugins: [ + // 移除 fill 属性 + { + name: "removeAttrs", + params: { + attrs: "fill" + } + } + ] + } }), // 原子化 CSS UnoCSS()