mirror of
https://github.com/tabler/tabler-icons.git
synced 2025-04-04 19:32:27 +02:00
modify icons import
This commit is contained in:
parent
c3aa7d1441
commit
2fcc841acc
13
gulpfile.js
13
gulpfile.js
@ -842,6 +842,10 @@ gulp.task('import', gulp.series((cb) => {
|
||||
|
||||
fileData = optimizeSVG(fileData);
|
||||
|
||||
if(fileData.match(/transform="/)) {
|
||||
throw new Error(`File ${file} has \`transform\` in code!!`);
|
||||
}
|
||||
|
||||
fileData = fileData
|
||||
.replace(/---/g, '')
|
||||
.replace(/fill="none"/g, '')
|
||||
@ -869,6 +873,15 @@ gulp.task('import', gulp.series((cb) => {
|
||||
fileData = fileData
|
||||
.replace(/<svg>/g, '---\n---\n<svg>')
|
||||
|
||||
if(fs.existsSync(`./src/_icons/${filename}.svg`)) {
|
||||
const newFileData = fs.readFileSync(`./src/_icons/${filename}.svg`).toString();
|
||||
const m = newFileData.match(/(---.*---)/gms)
|
||||
|
||||
if(m) {
|
||||
fileData = fileData.replace('---\n---', m[0])
|
||||
}
|
||||
}
|
||||
|
||||
fs.writeFileSync(`./src/_icons/${filename}.svg`, fileData)
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user