package.json
"scripts": {
"compile:sass": "node-sass sass/main.scss css/style.css -w"
}
main.scss
@import "abstracts/variables";
@import "base/typography";
_variables.scss
$color-light-grey: #777;
$color-white: #fff;
_typography.scss
body {
color: $color-light-grey;
}
.heading-primary {
color: $color-white;
}
Now my issue is when I'm trying to compile with npm run compile:sass
it throws the following error:
"message": "Undefined variable: \"$color-light-grey\"."
convert all file names with beginning "_"
example:
typography.scss >> to >> _typography.scss
Looks like there are two errors in your code above:
"abstracts/variables"
but, at least in the text, the file name seems to be _variables.scss
(missing an "s")"abstracts/variables"
before everything else.Like that:
@import "abstracts/variables";
@import "base/typography";
Simply import everything in this order
- abstracts
- vendors
- base
- layout
- components
- pages
- themes
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.