This example I'm referencing is by Chris Coyer
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" mlns:xlink="http://www.w3.org/1999/xlink" style="display: none;">
<defs>
<g id="icon-image">
<path class="path1" d="M0 4v26h32v-26h-32zM30 28h-28v-22h28v22zM22 11c0-1.657 1.343-3 3-3s3 1.343 3 3c0 1.657-1.343 3-3 3-1.657 0-3-1.343-3-3zM28 26h-24l6-16 8 10 4-3z"></path>
</g>
</defs>
</svg>
<h1>
<svg viewBox="0 0 32 32">
<use xlink:href="#icon-phone"></use>
</svg>
Call me
However, I want to store the path definitions separately from the HTML so they can be used throughout the app.
Is there a way to achieve this without having to manually inject the svg using JavaScript?
I have explored various methods of embedding and linking SVG paths and files, but need to ensure that I can style them dynamically with currentColor. Using external SVG files in an img tag doesn't allow for this, as explained in detail in this blog post.
The closest solution I've found is the example above. However, I still prefer not to embed the path directly in the HTML. Is there a way to place it in an external file for reusability?