SVG Injector

Fast, caching, dynamic inline SVG DOM injection library

Plugin Documentation

Usage

JS

In order to use this plugin on your page you will need to include the following script in the page.


<script src="assets/libs/svg-injector/dist/svg-injector.min.js"></script>
                                    

Initialization

Add the below init function before the closing </body> tag, to enable it.


<script>

    // Elements to inject
    var mySVGsToInject = document.querySelectorAll('img.feather, img.svg-injector');

    // Do the injection
    SVGInjector(mySVGsToInject);

</script>

Examples

... ... ... ...

<img class="feather display-6" src="../html/assets/img/svg/arrow-left.svg" alt="...">
<img class="feather display-6" src="../html/assets/img/svg/arrow-up.svg" alt="...">
<img class="feather display-6" src="../html/assets/img/svg/arrow-right.svg" alt="...">
<img class="feather display-6" src="../html/assets/img/svg/arrow-down.svg" alt="...">