-
-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Labels
Description
I have tried multiple ways to include a variables.scss file in a Rails 5.2.1/VueJS/Webpacker project, with no joy. This is what I have for my webpack/loaders/sass-resources-loader.js:
environment.loaders.get('vue').use[0].options.loaders = {
scss: [
'vue-style-loader',
'css-loader',
'sass-loader',
{
loader: 'sass-resources-loader',
options: {
resources: [
path.resolve(__dirname, 'app', 'javascript', 'variables.scss'),
],
},
},
],
}but the Vue component that references a variable defined in variables.scss fails to compile with a message Undefined variable: "$header-background-colour".
I've tried various other means of specifying the path:
variables.scssjavascript/variables.scssapp/javascript/variables.scss../app/javascript/variables.scss../../app/javascript/variables.scss../../../app/javascript/variables.scss
All fail.
Currently I have to manually @import 'variables.scss'; into every component, which is not ideal. What is the correct way to specifying the path <rails root>/app/javascript/variables.scss? I'd be happy to add a PR to the docs to give an example of configuring for Rails once I've worked it out :)
Reactions are currently unavailable