My company currently includes a fairly large SVG sprite containing various icons in the index.html of our AngularJS web application. The main SVG is hidden by CSS, and we show the individual icons from the SVG, selecting them by their identifiers:
<svg> <use xlink:href="#icon-id"></use> </svg>
Now we are trying to reduce the loading time of our site by dividing the SVG and introducing the resulting parts into the pages that they need. Since we also go to Webpack to link our application, we want to specify the dependencies for a specific SVG file in the Angular module, and then Webpack to insert the contents of the SVG - possibly wrapped in a DOM div-in. Is there a way to achieve this using an existing bootloader? I found a raw-loader that basically exports the contents of our SVG. However, I do not know how to associate it with another loader that will be inserted into the DOM, for example, say, a style loader.
Any help is greatly appreciated.
Felix
Felix source share