My Question
Before reading further, by ‘without component’, I mean that my plugin does not require a component as there is no template, it is simply a custom vue.js Directive that serves as a wrapper to a class. However, that does not mean that when not willing to use a component in order to include the necessary styles if this cannot be avoided…
Consider the following plugin (proposed file structure):
src
index.js
SomeClass.js
sass // (not sure about this)
core.scss
index.js installs the vue.js plugin and defines a custom directive that calls certain methods on the SomeClass class
SomeClass.js provides all required functionality
sass/core.scss provides any necessary styles required for the plugin
My question, quite simply, is how do I include the core.scss file when the vue.js plugin is installed? Or, what would be a better file structure, thus way to include the styles required for the plugin?
Ideally, I would like to avoid using a template as there is no HTML inserted, my plugin simply adds styles to already defined elements in the DOM.
Solution :
For anyone stumbling upon this, the solution was extremely easy… I simply placed the following at the top of my index.js:
import ‘./sass/_core.scss’;
I wasn’t aware that you could import CSS/SASS files directly into Javascript files…