drdk / grunt-dr-svg-sprites

Grunt plugin to create SVG sprites with PNG fallbacks at needed sizes
113 stars 19 forks source link

SVGs containing paths with boolean operations are not processed correctly #27

Closed WillsB3 closed 9 years ago

WillsB3 commented 10 years ago

I'm not great with vector apps, but I'm having some difficulty getting this plugin to process some SVG's I've been given correctly.

Take this test SVG for example. If I open it with preview in OS X or Sketch it looks like this:

screen shot 2014-08-08 at 09 57 06

Once processed by grunt-dr-svg-sprites however, it looks like this in both the browser and Adobe Illustrator:

0178878e-1eda-11e4-97ff-876f974c8350

Oddly enough it still looks fine when the generated sprite SVG is loaded back into sketch:

screen shot 2014-08-08 at 10 00 02

Is this something I'm doing wrong or could this be caused by this plugin or Sketch's export process?

phloe commented 10 years ago

The problem lies in the svgo module that is used under the hood :( By default svgo is run with all of its plugins enabled - which in this case is causing trouble. Plugins can be configured through options.svgo though. But finding the plugin that is tripping up the svg can be a bit of a pain... The full list is here.

bomberstudios commented 10 years ago

Check this out: https://gist.github.com/chadclark/d54769526f0dfaaa62ea

phloe commented 10 years ago

@bomberstudios Thanks for the heads up! It looks like it's the removeUselessStrokeAndFill-plugin that's messing up the svg.

var options = {
    // some options
    svg: {
        plugins: [
            { removeUselessStrokeAndFill: false }
        ]
    }
    // more options
};
bomberstudios commented 10 years ago

Always happy to help : )

phloe commented 9 years ago

FWIW I just added some defaults for the svgo config; removeUselessStrokeAndFill is now disabled by default. Live in dr-svg-sprites 0.9.14 :)