[Vuejs]-How to reference style tag element in Vue.js

0๐Ÿ‘

โœ…

I was able to fix my main goal of reusing the same CSS by using external css in the style tag and importing the css as a string using raw-loader.

import css from !!raw-loader!./my-css.css
...
<style src="./my-css.css">

I still do not know how to get a safe reference to the style tag, but the above solves my issue.
* The reason for the style tag not being easily referenced even via document.querySelector is that the build process seems to strip attributes.

Leave a comment