JetBrains / svg-sprite-loader

Webpack loader for creating SVG sprites.
MIT License
2.02k stars 271 forks source link

Please make it possible to turn off automatically adding ids in <styles>!! It's breaking svg's #453

Open bencresty opened 3 years ago

bencresty commented 3 years ago

Do you want to request a feature, report a bug or ask a question?

Using the sprite-loader inline styles like .a { fill: #ff0; } are changed by the loader to #icon-name .a { fill: #ff0; }. This is breaking code here as we use the innerHTML of the <symbol> with the icon. We could add the id to the usage of that innerHTML, but than our HTML would be illegally contain duplicate ids. So that's a no go.

Please add a config setting to prevent altering the selectors inside the <styles> section of a <symbol>!

What is the current behavior?

Automatically ids get inserted in the <styles> selector of a symbol

What is the expected behavior?

No changing of the selectors in the <styles> section when new optional setting is set to false to turn this off.

If this is a feature request, what is motivation or use case for changing the behavior?

See above; we use innerHTML because that's way faster in performance than using <use> in animations. <use> has important cons.

Please tell us about your environment: