From 12e5099c921334a1c0b092fb965b4c9ee8c8bc8e Mon Sep 17 00:00:00 2001 From: Broc Seib Date: Tue, 1 Oct 2019 17:24:57 -0400 Subject: [PATCH] Preserve viewBox attribute in SVG sprite symbols When generating the SVG sprite (using imagemin and svstore) the imagemin step needs to NOT cleanup/remove the viewBox attributes from the individual svg files. fixes #1306 --- gulpfile.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 2623ebaf..3a4c7bdf 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -222,7 +222,11 @@ Object.entries(build.sprite).forEach(([filename, entry]) => { gulp .src(src) .pipe(plumber()) - .pipe(imagemin()) + .pipe(imagemin([ + imagemin.svgo({ + plugins: [{ removeViewBox: false }] + }) + ])) .pipe(svgstore()) .pipe(rename({ basename: path.parse(filename).name })) .pipe(size(sizeOptions))