【发布时间】:2016-03-24 04:04:16
【问题描述】:
我有一个 gulp 3 文件,我正在尝试将其升级到 gulp 4。当我这样做时,有些任务会起作用,而其他任务则不会。我得到的三个错误如下:
干净的风格:
gulp.task('clean-styles', function (done) {
var files = config.temp + '**/*.css';
clean(files, done);
});
[23:47:05] The following tasks did not complete: clean-styles
[23:47:05] Did you forget to signal async completion?
scss-watcher:
gulp.task('scss-watcher', function () {
gulp.watch([config.scss], ['styles']);
});
[23:51:27] 'scss-watcher' errored after 2.46 ms
[23:51:27] Error: watching ./src/client/styles/styles.scss: watch task has to be a function (optionally generated by using gulp.parallel or gulp.series)
styles:(如果我删除 clean-styles 系列,这将起作用)
gulp.task('styles', gulp.series('clean-styles', function () {
log('Compiling SCSS --> CSS');
return gulp
.src(config.scss)
.pipe($.scss())
.pipe($.autoprefixer({ browsers: ['last 2 versions', '> 5%'] }))
.pipe(gulp.dest(config.temp));
}));
[23:52:42] The following tasks did not complete: styles, clean-styles
[23:52:42] Did you forget to signal async completion?
兽医:(作品)
gulp.task('vet', function () {
log('Analyzing source with ESLint');
return gulp
.src(config.js)
.pipe($.if(args.verbose, $.print()))
.pipe($.eslint())
.pipe($.eslint.format())
.pipe($.eslint.failOnError());
});
功能:
function clean(path, done) {
log('Cleaning: ' + $.util.colors.blue(path));
del(path, done);
}
function log(msg) {
if (typeof(msg) === 'object') {
for (var item in msg) {
if (msg.hasOwnProperty(item)) {
$.util.log($.util.colors.blue(msg[item]));
}
}
}
else {
$.util.log($.util.colors.blue(msg));
}
}
我必须遗漏一些东西。任何人都可以填写我缺少的内容吗?
【问题讨论】:
标签: javascript gulp build-automation