arkon / ng-inline-svg

[Inactive] Angular directive for inserting an SVG file inline within an element.
https://echeung.me/ng-inline-svg/
MIT License
210 stars 88 forks source link

Option to modify SVGElement before it is cached. #127

Closed Ketec closed 3 years ago

Ketec commented 4 years ago

I would like to do some sanitation/cleanup on the SVG-s before it is cached - so I don't have to do it every time in the onSVGLoaded.

Dealing with a larger number of icons etc coming from design, they leave sometimes junk in there or conflicting data. Like <defs> for styles with some standard class name that now becomes global and cause conflicts. In this case, I would like to move the contents of defs outside into local scope for the svg.

This could also be a property - when you inline svg, last thing you want is for it to inject global styles, filter etc with duplicate names.

arkon commented 4 years ago

It's not really clear to me how this differs from onSVGLoaded. Do you have a more concrete example (or pseudocode)?

It also sounds like you might want to just preprocess your SVGs before using them in your app anyway.