SASS 内置模块错误 : Invalid CSS after

标签 sass module gulp

我没有连接内置模块,或者我没有正确使用它们。请帮我。我使用了 gulp,但我不明白为什么会出现错误:Error: Invalid CSS after "... $height: math": expected expression (e.g. 1px, bold), was ".div($size, 2)".scss 文件

@use 'sass:math';

$height: math.div($size, 2);
gulp 文件
...
function styles() {
  return gulp
    .src("./src/scss/*.scss")
    .pipe(plumber({ errorHandler: onError }))
    .pipe(sourcemaps.init())
    .pipe(sass())
    .pipe(
      autoprefixer({
        cascade: false,
      })
    )
    .pipe(cleanCSS())
    .pipe(sourcemaps.write())
    .pipe(rename({ suffix: ".min" }))
    .pipe(gulp.dest("./dest/css"))
    .pipe(browserSync.stream())
}
...

最佳答案

我使用了 gulp-sass,而不是 gulp-dart-sass。
因为 sass:math 兼容性:从 1.23.0 开始 Dart Sass

关于SASS 内置模块错误 : Invalid CSS after,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67849666/

相关文章:

css - Susy 2 Alpha 4 网格布局

css - 我们可以在已经使用 LESS 作为 css 预处理器的 Angular 1.6.6 中使用 SCSS css 预处理器吗?

python - nn.MaxPool2d 与 nn.function.max_pool2d 之间的区别?

build - GulpJS : How to rev images and then update their refs in css files?

javascript - 固定位置的 Div 仍然滚动?

javascript - ReactJS 使 <head> html 标签在 react 元素中导入 css/sass 时可见

Python 模块 - 运行时会发生什么?

正确的 C 头结构

javascript - 使用 gulp-git 克隆带有凭据的 git 存储库

javascript - 使用 Gulp、Babel 和 config.yml 发出异步完成信号