[英]Gulp create zip after all other tasks
I have a gulp file with a few different tasks. 我有一个带有一些不同任务的gulp文件。 When I want to make a production build I run,
gulp.task('build', ['styles', 'uglify', 'copyScripts', 'copyImgs', 'copyFonts', 'compress']);
当我想进行生产构建时,运行
gulp.task('build', ['styles', 'uglify', 'copyScripts', 'copyImgs', 'copyFonts', 'compress']);
. 。 The problem I am having is that I need the task
compress
to run after all others are finished. 我遇到的问题是我需要所有其他任务完成后才能运行任务
compress
。
You can try the following: 您可以尝试以下方法:
function compressFn(){
// write the code to compress here
}
// For backward compatibility with other tasks
gulp.task('compress', compressFn);
// It performs first all the tasks in the array THEN it calls compressFn
gulp.task('build', ['styles', 'uglify', 'copyScripts', 'copyImgs', 'copyFonts'], compressFn);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.