From 7bd866831780abcf5a59c4cbb7d1be456eea7c99 Mon Sep 17 00:00:00 2001
From: wangzhibo <wangzhibo@shsening.com>
Date: 星期五, 14 八月 2026 10:13:57 +0800
Subject: [PATCH] add shop module
---
packages/vite-plugin/src/svg/index.ts | 22 ++--------------------
1 files changed, 2 insertions(+), 20 deletions(-)
diff --git a/packages/vite-plugin/src/svg/index.ts b/packages/vite-plugin/src/svg/index.ts
index 88df6d3..0ab0793 100644
--- a/packages/vite-plugin/src/svg/index.ts
+++ b/packages/vite-plugin/src/svg/index.ts
@@ -2,7 +2,6 @@
import { basename, extname } from "path";
import { rootDir } from "../utils";
import svgo from "svgo";
-import { config } from "../config";
let svgIcons: string[] = [];
@@ -11,28 +10,12 @@
const dirs = readdirSync(dir, {
withFileTypes: true,
});
-
- // 鑾峰彇褰撳墠鐩綍鐨勬ā鍧楀悕
- const moduleName = dir.match(/[/\\](?:src[/\\](?:plugins|modules)[/\\])([^/\\]+)/)?.[1] || "";
-
for (const d of dirs) {
if (d.isDirectory()) {
arr.push(...findSvg(dir + d.name + "/"));
} else {
if (extname(d.name) == ".svg") {
- const baseName = basename(d.name, ".svg");
-
- // 鍒ゆ柇鏄惁闇�瑕佽烦杩囨嫾鎺ユā鍧楀悕
- let shouldSkip = config.svg.skipNames?.includes(moduleName);
-
- // 璺宠繃鍖呭惈icon-
- if (baseName.includes("icon-")) {
- shouldSkip = true;
- }
-
- const iconName = shouldSkip ? baseName : `${moduleName}-${baseName}`;
-
- svgIcons.push(iconName);
+ svgIcons.push(basename(d.name, ".svg"));
const svg = readFileSync(dir + d.name)
.toString()
@@ -54,7 +37,7 @@
if (!/(viewBox="[^>+].*?")/g.test($2)) {
content += `viewBox="0 0 ${width} ${height}"`;
}
- return `<symbol id="icon-${iconName}" ${content}>`;
+ return `<symbol id="icon-${d.name.replace(".svg", "")}" ${content}>`;
})
.replace("</svg>", "</symbol>");
@@ -62,7 +45,6 @@
}
}
}
-
return arr;
}
--
Gitblit v1.9.1