From ef4899c2d98e9639a746660d37983afdc79fb3cd Mon Sep 17 00:00:00 2001 From: codecalm Date: Wed, 19 Aug 2020 13:45:47 +0200 Subject: icons optimize, `behance` fix --- gulpfile.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'gulpfile.js') diff --git a/gulpfile.js b/gulpfile.js index 43c55a7..79535ba 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -399,6 +399,10 @@ gulp.task('icons-stroke', gulp.series('build-jekyll', function (cb) { })); gulp.task('optimize', function (cb) { + const addFloats = function(n1, n2) { + return Math.round((parseFloat(n1) + parseFloat(n2)) * 1000) / 1000 + }; + glob("src/_icons/*.svg", {}, function (er, files) { files.forEach(function (file, i) { @@ -412,7 +416,20 @@ gulp.task('optimize', function (cb) { .replace(/\n\s*<(line|circle|path|polyline|rect)/g, "\n <$1") .replace(/polyline points="([0-9.]+)\s([0-9.]+)\s([0-9.]+)\s([0-9.]+)"/g, 'line x1="$1" y1="$2" x2="$3" y2="$4"') .replace(/a\s?([0-9.]+)\s([0-9.]+)\s([0-9.]+)\s?([0-1])\s?([0-1])\s?(-?[0-9.]+)\s?(-?[0-9.]+)/g, 'a$1 $2 $3 $4 $5 $6 $7') - .replace(/\n\n+/g, "\n"); + .replace(/\n\n+/g, "\n") + + .replace(/