Open gzaripov opened 5 years ago
Any news on this?
This problem has already been raised in https://github.com/JetBrains/svg-sprite-loader/issues/304 @kisenka wrote there "But why you need width and height, if you already has viewBox?", I can explain this moment.
viewBox defines the position and dimension of an SVG viewport, not sizes. SVG without sizes goes to the default size of 300px width and 150px height. For many icons other defaults are more appropriate. Yes, sizes can be set using css, but styles may not load. You can also specify the dimensions in html, but an inexperienced developer can forget about it. In any case, having the default width and height into SVG icon is safer. If someone does not need certain attributes, he can always use svgo-loader, but deleting something without the undo option is very inconvenient.
Seems, that svg attributes are trimmed in extract: false
mode as well. I agree with @alkorlos - it's really inconvenient. Why don't allow configure preserve
list of svgToSymbol
? In my case, I have proper width/height and viewBox attributes inside the exported svg from Figma. I don't need to set them manually. I want to set default width/height attributes to the <use>
's parent <svg>
element automatically without css. Workaround in custom-runtime-generator-extract-mode example with dimensions extraction from viewBox seems kludgy.
Here is one of SVG files I use
And this is svg in extracted file
Expected behaviour:
width="24" height="24"
Please tell us about your environment:
here is my config file: