根据参数触发gulp任务

时间:2014-04-22 14:27:32

标签: javascript triggers task gulp

是否可以根据参数标志触发相关任务?

示例:

//task one will be triggered like this from the command line
gulp one --flag

//gulpfile
gulp.task('one', function() {
  if(gutil.env.flag) {
    //run task two
  } else {
    //run task three
  }
});

gulp.task('two', function() { });
gulp.task('three', function() { });

此要求最接近的是gulp.run,但现已弃用。大多数参考文献指向gulp.watch,但我不想看任何文件。我只需要查找参数并相应地触发任务。

编辑1:一位同事向我指出run-sequence plugin。虽然它符合我的目的,但网站上发布了一条警告&#34; 请注意,此解决方案是黑客攻击,可能会停止使用未来的orchestrator更新。&#34; < / p>

0 个答案:

没有答案