对不合法名称icon做检测停止加入图标库

This commit is contained in:
piexlMax
2023-12-10 23:47:30 +08:00
parent 0f2018d913
commit 2307ac88cb
3 changed files with 5 additions and 2 deletions
+5
View File
@@ -33,6 +33,11 @@ const registerIcons = async(app) => {
const response = await fetch(path)
const svgContent = await response.text()
const iconName = path.split('/').pop().replace(/\.svg$/, '')
// 如果iconName带空格则不加入到图标库中并且提示名称不合法
if (iconName.indexOf(' ') !== -1) {
console.error(`icon ${iconName}.svg includes whitespace`)
continue
}
const iconComponent = createIconComponent(svgContent)
config.logs.push({
'key': iconName,