我试图做到这一点,因此如果未指定 --theme 标志,它会停止 gulp 任务,并想知道以 DRY 方式执行此操作的最佳方法。
我希望每个单独的任务在未指定 --theme 的情况下停止,并且在不满足条件时也让默认任务停止。
到目前为止我已经尝试了一些事情但没有运气。
Thanks,
gulp.task('test', function() {
if(typeof(args.theme) == 'undefined' || args.theme === true) {
console.log(msg.noTheme);
return; // end task
}
// run rest of task...
});
gulp.task('test-2', function() {
if(typeof(args.theme) == 'undefined' || args.theme === true) {
console.log(msg.noTheme);
return; // end task
}
// run rest of task...
});
gulp.task('default', ['test-1', 'test-2']);
您可以简单地停止脚本:
process.exit()
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)