Show HN: Make external SVG files styleable with CSS through injection

Show HN: Make external SVG files styleable with CSS through injection

Include the SVGInject Javascript file in the element of the HTML document, or anywhere before the first usage of SVGInject

If you are using npm

If you are using Yarn

Add to any element where you want the SVG to be injected. SVGInject is intended to work in production environments however it has a few limitations you should be aware of:

All attributes are copied from the element to the injected element before injection with the following exceptions:

You can disable the previously described attribute handling by setting the option to . If the browser does not support SVG, this simple fallback solution replaces the attribute with an alternative image URL.

Source: github.com