iconic/SVGInjector

[Request] Ability to prune <style> elements *before* injection

ezzatron opened this issue · 0 comments

SVGInjector is fantastic, I'm using it in the documentation for my software project.

In said documentation, I have ~30 very similar SVGs (examples of colored console output). Each SVG contains its own <style> element so that they remain portable. The problem is that when all of them are embedded, the browser is inundated with ~30 copies of the same style rules.

Removing the <style> elements afterward, with the each callback, is too late to mitigate any performance impact they might have.

If I could define a callback that pruned the <style> elements before they were appended, I could eliminate this problem. Alternatively, perhaps all I need is an option like evalScripts, but for styles (perhaps includeStyles?).