【问题标题】:Sass and webpack - @for loop errorSass 和 webpack - @for 循环错误
【发布时间】:2017-01-03 22:40:09
【问题描述】:

这是我的代码:

@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"]
},

谢谢

【问题讨论】:

    标签: sass webpack


    【解决方案1】:

    这是因为您有样式加载器和 css 加载器。我猜这导致了重新处理。删除样式加载器,它应该可以工作。至少这是我遇到类似错误的问题

    【讨论】:

      猜你喜欢
      • 2012-01-03
      • 1970-01-01
      • 2016-08-15
      • 2014-07-13
      • 1970-01-01
      • 2018-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多