Currently, I am incorporating SVG Icons that I created in Illustrator into my Vue.js Webapp. I have utilized Webpack's "require" to load the icons. Rather than accessing the SVGs directly using the src attribute of the img tag, I am inserting them using Vue in the following manner:
<div class="section-icon" v-html="getIconForEvent(event)"></div>
This method successfully displays the icon in the correct location, but I have encountered some issues with this approach.
All the SVGs come with their own style embedded within them, leading to a problem where the style of the last SVG overwrites the style of all the previous SVGs as they share the same class attribute. This can be observed in the Chrome Devtools like this.
Is there a way I can prevent the styles of different SVGs from conflicting with each other? I did not manually insert the style tags, they are inherent to the SVGs themselves. Appreciate your help!