Gulp 导入问题时吞咽sass观察任务

Gulp 导入问题时吞咽sass观察任务,gulp,gulp-watch,gulp-sass,Gulp,Gulp Watch,Gulp Sass,我想大口大口大口地喝一口,结果遇到了问题。 我有以下sass目录: main.scss //all custom styling mixins.scss //custom mixins variables.scss //custom variables style.scss //file that imports all the above with bootstrap and fontawesome 当我运行gulp时,所有的东西都被编译了,并且没有错误,我得到了正确的sytle.min.c

我想大口大口大口地喝一口,结果遇到了问题。 我有以下sass目录:

main.scss //all custom styling
mixins.scss //custom mixins
variables.scss //custom variables
style.scss //file that imports all the above with bootstrap and fontawesome
当我运行gulp时,所有的东西都被编译了,并且没有错误,我得到了正确的sytle.min.css,包括了所有的样式。 但是,当我更改一个监视的文件(main.scss | | | mixin.scss | | | variables.scss)时,会出现以下错误之一:“未定义变量”,“未命名混合…”

另外,如果我更改并保存main.scss,我不会得到任何错误,但是没有任何自定义的scss文件被包含到css中,只会编译带有FONTSTRAP的引导

我的设置有什么问题

gulpfile.js style.scss
好的,在调用sass任务之前,我通过向我的watch任务添加timeout来修复它:


要么是IDE(sublime 2)的保存延迟问题,要么是服务器ping问题。

10x伙计,我尝试了数千种方法来实现这一点,但损失了数小时的头痛!我尝试使用sassGlob()和sass的includePaths设置,但似乎解决了这个问题。
var gulp = require('gulp'),
    sass = require('gulp-sass'),
    notify = require("gulp-notify"),
    concat = require('gulp-concat'),
    minifycss = require('gulp-minify-css'),
    uglify = require('gulp-uglify'),
    rename = require('gulp-rename')
    bower = require('gulp-bower')
    merge = require('merge-stream')
    watch = require('gulp-watch');

var config = {
    destPath: './dist',
    sassPath: './src/sass',
    jsPath: './src/js',
    bowerDir: './src/components'
}

gulp.task('bower', function() {
    return bower()
    .pipe(gulp.dest(config.bowerDir));
});

gulp.task('icons', function() {
    var fontawesome = gulp.src(config.bowerDir + '/font-awesome/fonts/**.*')
    .pipe(gulp.dest('./src/fonts'));

    var bootstrap = gulp.src(config.bowerDir + '/bootstrap-sass/assets/fonts/bootstrap/**.*')
    .pipe(gulp.dest('./src/fonts/bootstrap'));

    return merge(fontawesome, bootstrap);
});


gulp.task('sass', function() {
    console.log(config.sassPath);
    var stream = gulp.src([config.sassPath + '/style.scss'])
        .pipe(sass().on('error', sass.logError))
        // .pipe(concat('style.css'))
        .pipe(minifycss())
        .pipe(rename('style.min.css'))
        .pipe(gulp.dest(config.destPath));
    return stream;
});

gulp.task('js', function() {
    var stream = gulp.src([config.bowerDir + '/jquery/dist/jquery.js', config.bowerDir + '/bootstrap-sass/assets/javascripts/bootstrap.js', config.jsPath + '/*.js'])
        .pipe(concat('script.js'))
        .pipe(uglify())
        .pipe(rename('script.min.js'))
        .pipe(gulp.dest(config.destPath)); 
    return stream;
});

gulp.task('watch', function(){
    watch([config.sassPath + '/*.scss'], function(event, cb) {
        gulp.start('sass');
    });
    watch([config.jsPath + '/*.js'], function(event, cb) {
        gulp.start('js');
    });
});

gulp.task('default', ['bower', 'icons', 'js','sass', 'watch']);
@import "./variables.scss";
@import "./mixins.scss";
@import "../components/bootstrap-sass/assets/stylesheets/bootstrap.scss";
@import "../components/font-awesome/scss/font-awesome.scss";
@import "./main.scss";
watch([config.sassPath + '/*.scss'], function(event, cb) {
    setTimeout(function(){
        gulp.start('sass');
    }, 1000);
});