w0rm/gulp-svgstore

viewbox attribute being removed?

nachtfunke opened this issue · 1 comments

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?

w0rm commented

Hi! Svgstore should copy viewBox from a source svg to a corresponding symbol, tested here.

Have you tried removing svgmin and seeing if the issue is there?