0

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?我究竟做错了什么?

4

1 回答 1

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;
}
于 2014-02-22T20:53:49.560 回答