Gulp sass使用*.scss查看缺少的属性值

Gulp sass使用*.scss查看缺少的属性值,sass,gulp,gulp-watch,gulp-sass,Sass,Gulp,Gulp Watch,Gulp Sass,我的目标是查看我所有的scss文件 有了下面所有的代码,如果我的 config.path.src.styles的设置如下 /styles/app.scss 但是当我把它改成 /styles/*.scss 我有 错误:_theme.scss:13:20:缺少属性值 问题何时出现 我使用@extend.container; 不是普通的css 吞咽任务 style.js watch.js 'use strict'; var gulp = require('gulp'); module.expor

我的目标是查看我所有的scss文件

有了下面所有的代码,如果我的

config.path.src.styles的设置如下

/styles/app.scss

但是当我把它改成

/styles/*.scss

我有

错误:_theme.scss:13:20:缺少属性值

问题何时出现 我使用@extend.container; 不是普通的css

吞咽任务 style.js

watch.js

'use strict';

var gulp = require('gulp');


module.exports = gulp.task('watch', function() {
    var stylesWatcher = gulp.watch(config.paths.src.styles, ['styles']);
    stylesWatcher.on('change', function(event) {
        console.log('File ' + event.path + ' was ' + event.type + ', running tasks styles');
    });
});
app.scss

@import "variables";
@import "imports";
@import "theme";
_theme.js

.morra-sub-header{
  @include clearfix;
  @extend .container;
}
你可以看看整个大口的设置

结束

您应该在样式任务中使用app.scss

手表任务中的*.scss(愚蠢的我:)


这里的问题是,您的
*.scss
glob无需特殊订单即可获取所有内容。因此,可以首先选择
\u theme.scss
文件,因为它使用了
\u imports.scss
中尚未处理的变量,所以出现了错误

为了防止出现这种情况,您可以使用特定于阵列的模式,首先专门加载
\u imports.scss

config.paths.src.styles = [
  '_imports.scss',
  '*.scss'
];

尽管我不知道你为什么还要用管道传输你的部分内容,但是从
app.scss
导入的内容应该是好的。

Oh没有看到你的编辑,你可能应该删掉上一次的编辑,自己回答自己的问题[尽管我不知道你为什么还要用管道传输你的部分内容,但是从app.scss导入的内容应该是好的。]因为我想在编辑*.scss文件时一直重新加载css。只导入app.css不起作用。是的,我明白了,这就是为什么只有你的观察者需要所有东西,而你只在管道中传输
app.scss
文件,基本上就是你在编辑中说的:)
mainStyles: SRC_FOLDER + '/styles/app.scss',
styles: SRC_FOLDER + '/styles/*.scss',
module.exports = gulp.task('styles', function () {
  return gulp.src(config.paths.src.mainStyles)
    .pipe(autoprefixer('last 1 version'))
    .pipe(gulpif(release, csso()))
    .pipe(gulpif(release, sass(sassOptions).on('error', handleError), sass(sassOptions).on('error', handleError)))
    .pipe(rename(config.filenames.styles))
    .pipe(gulpif(release, gulp.dest(config.paths.dest.phonegap.styles), gulp.dest(config.paths.dest.build.styles) ))
    .pipe(gulpif(!release,reload({stream:true})));
});
module.exports = gulp.task('watch', function() {
    var stylesWatcher = gulp.watch(config.paths.src.styles, ['styles']);
    stylesWatcher.on('change', function(event) {
        console.log('File ' + event.path + ' was ' + event.type + ', running tasks styles');
    });
});
config.paths.src.styles = [
  '_imports.scss',
  '*.scss'
];