aboutsummaryrefslogtreecommitdiff
path: root/gulpfile.js
diff options
context:
space:
mode:
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/gulpfile.js b/gulpfile.js
index a1a8c1e..beb3969 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -50,3 +50,21 @@ gulp.task('icons-sprite', function (cb) {
cb();
});
});
+
+gulp.task('optimize', function(){
+ glob("_site/icons/*.svg", {}, function (er, files) {
+
+ files.forEach(function (file, i) {
+ let svgFile = fs.readFileSync(file),
+ svgFileContent = svgFile.toString();
+
+ svgFileContent = svgFileContent
+ .replace(/><\/(polyline|line|rect|circle)>/, '/>')
+ .replace(/\n\n+/g, "\n");
+
+ fs.writeFileSync(file, svgFileContent);
+ });
+
+ cb();
+ });
+});