Closed nachtfunke closed 7 years ago
This is the Code I am using:
gulp.task('svgstore', function() { return gulp.src(local.svg+'/singles/*.svg') pipe(svgmin({ plugins: [{ removeDoctype: true }, { removeXMLNS: true }, { removeXMLProcInst: true }, { removeComments: true }, { removeMetadata: true }, { removeEditorNSData: true }, { removeViewBox: false }] })) .pipe(cheerio(function ($, file) { $('[fill]').each(function() { if ( $(this).attr('fill') !== 'currentcolor' ) { $(this).attr('fill', 'currentcolor'); } }); })) .pipe(svgstore()) .pipe(gulp.dest(local.svg+'/sprites')); });
And so far, everything works fine, BUT all my svg's are not scaleable because the viewbox attribute is being removed. Can someone explain to me, why this is happening, or if I just have some sort of wrong mindset about this?
Hi! Svgstore should copy viewBox from a source svg to a corresponding symbol, tested here.
viewBox
Have you tried removing svgmin and seeing if the issue is there?
svgmin
This is the Code I am using:
And so far, everything works fine, BUT all my svg's are not scaleable because the viewbox attribute is being removed. Can someone explain to me, why this is happening, or if I just have some sort of wrong mindset about this?