I'm using svg-sprite to generate a SVG spritesheet to be embedded via the <use>
method:
<svg class="icon">
<use xlink:href="/assets/icons.svg#phone"/>
</svg>
This works nicely for embedding and styling icons via HTML markup.
However, I also need the option to embed icons purely via CSS. For example adding a content list via the CMS WYSIWYG editor should not requiring the content editor to add extra SVG elements.
For example:
<ul class="icon-list">
<li>Item 1</li>
<li>Item 2</li>
</ul>
.icon-list li::before { /* icon here */ }
Is there a way to achieve this with the <use>
embed method, or a similar method? The solution also needs to allow for colouring the SVG via CSS.