svg-sprite / gulp-svg-sprite

SVG sprites & stacks galore — Gulp plugin wrapping around svg-sprite that reads in a bunch of SVG files, optimizes them and creates SVG sprites and CSS resources in various flavours
MIT License
648 stars 43 forks source link

add class="my-class" to <symbol> #85

Closed 7daysofrain closed 6 years ago

7daysofrain commented 6 years ago

Hi,

Is there a way to add a fixed class to the tag?

Thanks

jkphl commented 6 years ago

@7daysofrain Sorry for not responding earlier, I'm on holiday at the moment. It's beyond (gulp-)svg-sprite's scope to do SVG manipulation other than needed for sprite compilation. You can, however, use a custom global transform to post-process the sprite before it gets saved. You'll have to write the code for adding the CSS class yourself inside a callback function that gets executed for this purpose, see documentation. Good luck!

7daysofrain commented 6 years ago

@jkphl just did that, It worked perfectly, thanks!