本文介紹了Gulp clean/del 行為已經改變的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我的 gulpfile.js 的一部分
Part of my 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的行為...
worked well.
Then I installed a new system and there maybe got new versions of gulp and del and whatever.
Now gulp stops after cleaning.
I can call all tasks manually, that's working fine.
Could only be a change in the behaviour of del...
我該如何解決這個問題?
How can I fix this?
推薦答案
v2
最重要的變化之一是它現在返回一個 Promise 而不是使用回調來處理異步.來自 del
文檔.
One of the most important changes on v2
is that now it returns a Promise instead of using a callback to handle async. From del
documentation.
您只需重新編寫這部分代碼:
You simply have to re-write this part of your code:
gulp.task('clean', function (cb) {
del([chrome_dir, ff_dir], cb);
});
像這樣:
gulp.task('clean', function () {
return del([chrome_dir, ff_dir]);
});
這篇關于Gulp clean/del 行為已經改變的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!