Optimized svg losing id's

Hi! I’m using svg’s that I want to manipulate with CSS and media queries but the minified versions of the svg’s are losing the id’s that I setup for different layers and groups via Illustrator. I modified the images gulp task and included a false flag for the cleanupIds plugin:

svgoPlugins: [{removeUnknownsAndDefaults: false, cleanupIDs: false}]

However, this did not work, does anybody know what other plugin I can turn off in order to keep my id’s from getting lost during the minification task? Thanks!

1 Like

For anybody who might be looking into this in the future:

I found the answer in the documentation of the gulp-imagemin package:

The svgoPlugins option accepts an array of comma separated JSON objects so for me the answer was:

svgoPlugin: [{removeUnknownsAndDefaults: false}, {cleanupIDs: false}]

By the way, this is my first time using gulp / bower and it’s awesome! Sage is awesome so many thanks to Roots!

4 Likes

Can you please submit a pull request adding this option to the default sage config? Definitely do not need dangerous optimizations like messing with IDs.

Edit: and glad you got it figured out!

All right! Done. I’m fairly new to git but followed the contributing guideline.

1 Like

Thank you for patching this up!