这是我的代码:
@for $i from 1 through 3 {
.myclass-#{$i} {
/* ... */
}
}
我正在使用 webpack
并收到此错误:
ERROR in ./~/css-loader!./~/sass-loader!./~/postcss-loader?pack=cleaner!./path/style.scss
/path/to/my/file/style.scss:649:22: Unknown word
You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser
@for $i from 1 through 3 {
.myclass-#{$i} {
^
有办法解决吗?
我使用这个配置:
{
test: /\.scss$/,
loaders: ["style", "css", "sass", "postcss?pack=cleaner"]
},
谢谢
最佳答案
发生这种情况是因为您有样式加载器和 css 加载器。我猜这导致了重新处理。删除样式加载器,它应该可以工作。至少这是我遇到类似错误的问题
关于Sass 和 webpack - @for 循环错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39180157/