T
T
thehighhomie2018-07-30 19:52:48
Vue.js
thehighhomie, 2018-07-30 19:52:48

VueJS: Is it possible to make global variables in preprocessors?

I do adaptation and theming of the application. There are some functions and variables that I need to use in every component like rem, getColor etc. and of course global variables are needed...
Of course, you don't want to constantly import styles into each component. Is it possible to implement my needs under vue?
PS: I use different preprocessors (stylus and sass) in different projects. I would like the solution (if any) to work with all preprocessors, otherwise I saw somehow under sass it was advised to use sass-resources-loader for these cases, but I work not only with sass.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
�
ⓒⓢⓢ, 2018-07-30
@thehighhomie

if I understood the question correctly, then it has little to do with vue, closer to the project builder.
if you are using webpack look at
style-resources-loader package

O
Oleg, 2018-07-30
@werty1001

For stylus, it is enough to globally specify files for import, for sass, it seems like you can’t do without crutches.

T
thehighhomie, 2018-07-31
@thehighhomie

Got it https: //cli.vuejs.org/guide/css.html#passing-optio ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question