aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gulpfile.js29
-rw-r--r--package.json1
2 files changed, 21 insertions, 9 deletions
diff --git a/gulpfile.js b/gulpfile.js
index bdda07da..96b69001 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -6,6 +6,7 @@ const gulp = require('gulp'),
p = require('./package.json'),
csv = require('csv-parser'),
zip = require('gulp-zip'),
+ svgo = require('gulp-svgo'),
puppeteer = require('puppeteer'),
outlineStroke = require('svg-outline-stroke'),
iconfont = require('gulp-iconfont'),
@@ -229,15 +230,25 @@ gulp.task('iconfont-svg-outline', function (cb) {
}
}).catch(error => console.log(error));
});
+ });
- // 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) {
- console.log(`Correcting svg outline directions exited with code ${code}`);
- if (!code) {
- cb();
- }
- });
+ cb();
+});
+
+gulp.task('iconfont-optimize', function() {
+ return gulp.src('icons-outlined/*')
+ .pipe(svgo())
+ .pipe(gulp.dest('icons-outlined'));
+});
+
+gulp.task('iconfont-fix-outline', function(cb) {
+ // 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) {
+ console.log(`Correcting svg outline directions exited with code ${code}`);
+ if (!code) {
+ cb();
+ }
});
});
@@ -332,7 +343,7 @@ gulp.task('update-tags-unicode', function(cb) {
cb();
});
-gulp.task('build-iconfont', gulp.series('iconfont-prepare', 'iconfont-svg-outline', 'iconfont', 'iconfont-css', 'iconfont-clean', 'update-tags-unicode'));
+gulp.task('build-iconfont', gulp.series('iconfont-prepare', 'iconfont-svg-outline', 'iconfont-fix-outline', 'iconfont-optimize', 'iconfont', 'iconfont-css', 'iconfont-clean', 'update-tags-unicode'));
gulp.task('build-zip', function () {
const version = p.version;
diff --git a/package.json b/package.json
index af6a8153..38d72400 100644
--- a/package.json
+++ b/package.json
@@ -65,6 +65,7 @@
"glob": "7.1.6",
"gulp": "4.0.2",
"gulp-iconfont": "10.0.3",
+ "gulp-svgo": "^2.2.1",
"gulp-zip": "5.0.2",
"lodash.template": "4.5.0",
"minimist": "1.2.5",