diff options
author | codecalm <codecalm@gmail.com> | 2021-04-18 17:17:35 +0200 |
---|---|---|
committer | codecalm <codecalm@gmail.com> | 2021-04-18 17:17:35 +0200 |
commit | 4746c5cb3b3e5e27136435c43ac448edc5d5487d (patch) | |
tree | 9330e39f08be236f33e09191f93a815b97f45e10 /gulpfile.js | |
parent | Release 1.40.0 (diff) | |
download | tabler-icons-4746c5cb3b3e5e27136435c43ac448edc5d5487d.tar.xz |
tags fixes
Diffstat (limited to 'gulpfile.js')
-rw-r--r-- | gulpfile.js | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/gulpfile.js b/gulpfile.js index 597b513a..63573eb5 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -30,7 +30,7 @@ if (fs.existsSync('./compile-options.json')) { if (typeof tempOptions!="object") { throw "Compile options file does not contain an json object"; } - + if (typeof tempOptions.includeIcons!="undefined") { if (!Array.isArray(tempOptions.includeIcons)) { throw "property inludeIcons is not an array"; @@ -39,22 +39,22 @@ if (fs.existsSync('./compile-options.json')) { } if (typeof tempOptions.strokeWidth!="undefined") { if (typeof tempOptions.strokeWidth!="string" && typeof tempOptions.strokeWidth!="number") { - throw "property strokeWidth is not a string or number"; + throw "property strokeWidth is not a string or number"; } - compileOptions.strokeWidth=tempOptions.strokeWidth.toString(); + compileOptions.strokeWidth=tempOptions.strokeWidth.toString(); } if (typeof tempOptions.fontForge!="undefined") { if (typeof tempOptions.fontForge!="string") { - throw "property fontForge is not a string"; - } + throw "property fontForge is not a string"; + } compileOptions.fontForge=tempOptions.fontForge; } - + } catch (error) { throw `Error reading compile-options.json: ${error}` } - -} + +} async function asyncForEach(array, callback) { for (let index = 0; index < array.length; index++) { @@ -240,13 +240,13 @@ gulp.task('iconfont-svg-outline', function (cb) { if (fs.existsSync('./.build/iconfont-unicode.json')) { iconfontUnicode = require('./.build/iconfont-unicode'); } - + await asyncForEach(files, async function (file) { - + const name = path.basename(file, '.svg'); - + if (compileOptions.includeIcons.length==0 || compileOptions.includeIcons.indexOf(name)>=0) { - + unicode = iconfontUnicode[name]; await console.log('Stroke for:', file, unicode); @@ -275,7 +275,7 @@ gulp.task('iconfont-svg-outline', function (cb) { } }).catch(error => console.log(error)); } - + }); cb(); @@ -290,7 +290,7 @@ gulp.task('iconfont-optimize', function() { gulp.task('iconfont-fix-outline', function(cb) { var fontForge= compileOptions.fontForge; - + // correct svg outline directions in a child process using fontforge const generate = cp.spawn(fontForge, ["-lang=py", "-script", "./fix-outline.py"], { stdio: 'inherit' }); generate.on("close", function (code) { @@ -717,7 +717,7 @@ const setVersions = function(version, files) { if(!svgFile.match(/version: ([0-9.]+)/i)) { svgFile = svgFile.replace(/---\n<svg>/i, function(m){ - return `version: ${version}\n${m}`; + return `version: "${version}\n${m}"`; }); fs.writeFileSync(`src/_icons/${file}.svg`, svgFile); |