【问题标题】:Gulp clean / del behaviour has changedGulp clean / del 行为已经改变
【发布时间】:2015-09-16 09:46:12
【问题描述】:

我的 gulpfile.js 的一部分

const del = require('del');
const chrome_dir = 'build/chrome';
const ff_dir = 'build/firefox';

gulp.task('clean', function (cb) {
    del([chrome_dir, ff_dir], cb);
});


gulp.task('default', ['clean'], function () {
    gulp.start('build packages', 'JS Backend', 'i18n', 'ExtRes', 'styles', 'JS Content', 'templates');
});

效果很好。
然后我安装了一个新系统,可能会有新版本的 gulp 和 del 等等。
现在 gulp 在清洁后停止。
我可以手动调用所有任务,效果很好。
只能是改变del的行为...

我该如何解决这个问题?

【问题讨论】:

  • del & gulp 的当前版本是什么
  • 吞咽:3.9.0,删除:2.0.2

标签: javascript node.js gulp


【解决方案1】:

v2 上最重要的变化之一是它现在返回一个 Promise,而不是使用 回调 来处理 async。来自deldocumentation

您只需重新编写这部分代码:

gulp.task('clean', function (cb) {
    del([chrome_dir, ff_dir], cb);
});

像这样:

gulp.task('clean', function () {
    return del([chrome_dir, ff_dir]);
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-16
    • 2020-03-09
    • 1970-01-01
    • 2020-03-16
    • 1970-01-01
    • 1970-01-01
    • 2023-04-11
    相关资源
    最近更新 更多