gulp-buster永远不会“完成”

时间:2014-02-22 20:29:04

标签: node.js gulp gulp-buster

我正在使用nodejs gulp来处理和最小化我的less文件以及缓存清除我正在使用gulp-buster,但是,当我添加gulp-buster管道任务永远不会完成。

这是Gulpfile.js的一部分:

var lessTask = function(event) {
    var response = gulp.src('./application/assets/desktop/less/**/*.less')
        .pipe(less({ paths: ['./application/assets/desktop/less/'] }))
        .pipe(autoprefixer( 'last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4' ))
        .pipe(gulp.dest('./public/lesscss'))
        .pipe(minifycss())
        .pipe(gulp.dest('./public/lesscss'))
        .pipe(watch(function(files){
            return files
                .pipe(buster('busters.json'))
                .pipe(gulp.dest('.'));
        }));

    return response;
}

gulp.task('less', lessTask);

当我执行该任务时,我得到了这个回复:

H:\Binary\nginx\foobar.se>gulp less
[gulp] Using file H:\Binary\nginx\foobar.se\Gulpfile.js
[gulp] Working directory changed to H:\Binary\nginx\foobar.se
[gulp] Running 'less'...
[gulp] app.css was added to watch
[gulp] 1 file was added from pipe

当我在没有.pipe(watch(function(...的情况下运行任务时,我得到了这个:

H:\Binary\nginx\foobar.se>gulp less
[gulp] Using file H:\Binary\nginx\foobar.se\Gulpfile.js
[gulp] Working directory changed to H:\Binary\nginx\foobar.se
[gulp] Running 'less'...
[gulp] Finished 'less' in 51 ms

为什么不完成gulp-buster?我做错了什么?

1 个答案:

答案 0 :(得分:0)

我没有使用watch函数,而是使用了buster函数。

var lessTask = function(event) {

    var response = gulp.src('./application/assets/desktop/less/**/*.less')
        .pipe(less({ paths: ['./application/assets/desktop/less/'] }))
        .pipe(autoprefixer( 'last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4' ))
        .pipe(gulp.dest('./public/lesscss'))
        .pipe(minifycss())
        .pipe(gulp.dest('./public/lesscss'))
        .pipe(buster('busters.json'))
        .pipe(gulp.dest('.'));

    return response;
}