akoenig / gulp-svg2png

A gulp plugin for converting SVGs to PNGs.
MIT License
54 stars 34 forks source link

Scaling no longer working #37

Open KnutSv opened 7 years ago

KnutSv commented 7 years ago

I've been using scaling svg2png(2) to create retina PNGs, but it no longer seems to be working since I updated to Mac OS Sierra.

Tried saving SVG from Illustrator and Sketch and with different SVG-versions (only presentational attributes renders anything).

ValentinCreative commented 7 years ago

Hi ! I think it's related to https://github.com/akoenig/gulp-svg2png/issues/30#issuecomment-252615636

Is there a new gulp plugin for this ? I didn't find any walkaround yet.

KnutSv commented 7 years ago

My current workaround is to use svg-scaler for the scaling part.

var svg2png = require('gulp-svg2png');
var svgmin = require('gulp-svgmin');
var svgscaler = require('svg-scaler');
...
    .pipe(svgmin([{removeViewBox: true}]))
    .pipe(svgscaler({ noSvgo: true, scale: 2 }))
    .pipe(svg2png())
...

This unfortunately doesn't work with svgs with outline strokes (it works, but it doesn't scale the stroke). So currently I'm using two svg-folders for each project, one with original svgs with outline strokes that i can easily modify when needed, and one where the outlines has been expanded so that the svgs can be converted correctly to pngs.