cascornelissen / svg-spritemap-webpack-plugin

SVG spritemap plugin for webpack
MIT License
207 stars 49 forks source link

Viewbox attr is absent in generated style-sprites. #173

Closed jekka-ua closed 3 years ago

jekka-ua commented 3 years ago

Description In earlier versions viewbox of each svg was passed to corresponding svg-sprite. Now it's disappearing. Why ?

Expected behavior source svg: `

`

viewBox attribute exists in sprite (like it was earlier): background: url(data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath fill='%236e6e6e' d='M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z'/%3e%3c/svg%3e)

Actual behavior

viewBox attribute is disappearing background: url(data:image/svg+xml,%3csvg xmlns=%27http://www.w3.org/2000/svg%27%3e%3cpath fill=%27%236e6e6e%27 d=%27M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z%27/%3e%3c/svg%3e)

Additional context As viewBox is absent background image is not scaling in browser !

It's not clear for me is this behavior a feature or a bug ? :)

jekka-ua commented 3 years ago

new SVGSpritemapPlugin('...svg', { styles: { keepAttributes: true, } } helped