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;
}
现在我的问题是,当我尝试使用
npm run compile:sass
进行编译时,它将引发以下错误:最佳答案
看起来上面的代码中有两个错误:
"abstracts/variables"
,但是至少在文本中,文件名似乎是_variables.scss
(缺少“s”)"abstracts/variables"
,然后再进行其他操作。 像那样:
@import "abstracts/variables";
@import "base/typography";
关于css - 使用node-sass编译SCSS时出现 undefined variable 错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47506906/