vbenjs / vite-plugin-svg-icons

Vite Plugin for fast creating SVG sprites.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[symbolId] 当设置 symbolId 为 icon-[name] 时,最后得到的symbolId中仍含有文件夹名称

canvascat opened this issue · comments

比如icons文件结构如下:

icons
├── icon2.svg
└── dir
    └── icon1.svg

symbolId 为 icon-[name] 时,icon1最后得到的id为 icon-dir/icon1,期望得到 icon-icon1

let fName = name
const { fileName = '', dirName } = discreteDir(name)
if (symbolId.includes('[dir]')) {
id = id.replace(/\[dir\]/g, dirName)
if (!dirName) {
id = id.replace('--', '-')
}
fName = fileName
}
id = id.replace(/\[name\]/g, fName)

解决了吗?

解决了吗?

@renzhao1113 还能怎么办,改改再发个包呗 https://github.com/canvascat/vite-svg-sprite