ソースを参照

[icon]Skip .DS_Store file when reading svg content

dufu1991 2 年 前
コミット
2772f05d2b
1 ファイル変更4 行追加2 行削除
  1. 4 2
      packages/rollup-plugin-stdf-icon/src/index.js

+ 4 - 2
packages/rollup-plugin-stdf-icon/src/index.js

@@ -39,8 +39,10 @@ function handleFile(inFile, outFile, fileName, simple = true) {
 	const svgs = fs.readdirSync(inFile);
 
 	svgs.forEach(svg => {
-		// 读取 svg 文件内容, 作为字符串
-		// Read the svg file content as a string
+		// 读取 svg 文件内容, 作为字符串,如果是 .DS_Store 文件,则跳过
+		// Read the svg file content as a string, if it is a .DS_Store file, skip it
+		const isDSStore = svg === '.DS_Store';
+		if (isDSStore) return;
 		const code = fs.readFileSync(`${inFile}/${svg}`, 'utf8');
 
 		// 使用 SVGO 进行优化