我正在使用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
?我做错了什么?
答案 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;
}