Loading a global scss mixin / variable file in version 3
See original GitHub issueHi
How does one achieve this - Loading a global settings file
{
loader: 'sass-resources-loader',
options: {
resources: path.resolve(__dirname, '../src/style/_variables.scss')
}
}
using vue-cli 3.0.0-beta.6
?
From information in the readme, I thought something like this in vue.config.js
:
css: {
loaderOptions: {
sass :
{
loader: 'sass-resources-loader',
options: {
resources: path.resolve(__dirname, 'src/scss/_variables.scss'),
},
},
}
}
will do the trick. But I’m getting an error if I try to use a a variable (e.g. $primary
) in a component:
color: $primary;
^
Undefined variable: "$primary".
in /src/App.vue (line 23, column 12)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:13
Top Results From Across the Web
How to import Sass/SCSS mixins global? - DEV Community
I import the two .scss files in the App.js so I can access the classes/mixins/variables global. But only the classes are accessible.
Read more >How to use a SASS $variable across multiple pages using ...
Hello Guys!! · 1. Have a index or main file where all your variables are declared in just like this (for me, my...
Read more >Vue 3 - setting up global Sass/SCSS variables - WebDevEtc
It is very easy to get Vue 3 set up with SCSS/Sass. I found it a bit of a pain to find instructions...
Read more >SASS | Use variables across multiple files - GeeksforGeeks
To use variables across multiple files in SASS is carried out by @import rule of SASS. @import rule which import Sass and CSS...
Read more >Globally Load SASS into your Vue.js Applications
As a project grows up, you start separating your SASS variables, mixins and functions in separate files. You can import them by using...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Note that this preprocessor-loader is not hot reloaded. You’ll have to shut down and restart the server if you make changes to see them.
See: https://github.com/vuejs/vue-cli/blob/dev/docs/guide/css.md#passing-options-to-pre-processor-loaders
EDIT: Fixed the link.