gulp-svg-sprites icon indicating copy to clipboard operation
gulp-svg-sprites copied to clipboard

Ability to disable path merging

Open briangonzalez opened this issue 10 years ago • 10 comments

First off, awesome module. We're using it in a production site and we're loving it.

We're hoping we can get an option to disable the path merging that svgo offers. Currently gulp-svg-sprites/svgo would combine the following paths into one path. This is not always ideal since you lose the ability to style individual paths with CSS.

In:

<g>
  <path d="foo">
  <path d="bar"> 
  <path d="baz">
</g>

Out:

<g>
  <path d="foo bar baz">
</g>

briangonzalez avatar May 20 '14 19:05 briangonzalez

Thanks!

Yeah I'm going to expose the SVGO options to the main config object in a coming release :)

shakyShane avatar May 20 '14 20:05 shakyShane

What would you say the ETA is on that?

briangonzalez avatar May 20 '14 20:05 briangonzalez

Also, willing to help.

briangonzalez avatar May 20 '14 20:05 briangonzalez

Would it be easier to just remove svggo from this plugin. Could just add a link in the readme to https://www.npmjs.org/package/gulp-svgmin

thomaswelton avatar May 30 '14 08:05 thomaswelton

svgo is not just used to compress the final file output, it's used on every svg so I'm not sure how we could remove it?

shakyShane avatar May 30 '14 14:05 shakyShane

Can't we just rip this bit out? https://github.com/shakyShane/gulp-svg-sprites/blob/master/lib/svg-utils.js#L15 Either way, no biggie. Just thinking if people used svgo themselves on their src svgs they could use plugins like gulp newer to only optimize files that have not already been compressed. And that overall removal of svgo from this plugin would speed things up a little

thomaswelton avatar May 30 '14 14:05 thomaswelton

I agree with that. I also think that it’s better to remove SVGO from this plugin.

I use SVGO quite often and it destroys some SVGs when certain options are not disabled. I figured out that these are the most problematic when enabled: convertTransform, convertPathData.

So another strong argument against bundling SVGO with this plugin is that it isn’t always non-destructive.

@shakyShane

svgo is not just used to compress the final file output, it's used on every svg

Why is that necessary? Wouldn’t it be enough to run SVGO over the final sprite output? If SVGO would be removed from this plugin, an user could simply run gulp-svgmin over the final output.

TomOne avatar Jun 21 '14 13:06 TomOne

Were you able to expose the SVGO plugins in the config?

mattrosno avatar Aug 14 '14 17:08 mattrosno

I agree with the above opinions that this plugin could leave SVGO out and pass off the optimization task to the user. I find that that kind of separation of responsibilities is straightforward and sensible with gulp.

davidtheclark avatar Sep 13 '14 17:09 davidtheclark

@shakyShane my two cents:

  • remove svgo dependency from package.json here, no need for it
  • update svg-sprite-data svgo dependency to 0.5.0, seems to fix many bugs for me like bad svg output
  • add cleanconfig options to readme, it already works

thanks!

vvo avatar Dec 21 '14 06:12 vvo