0

I'm using the yargs npm module to send arguments to my gulp tasks from the console like so;

$ gulp dev --minify

However, I can only send arguments on the initial run from the console. Is there a way I could send arguments to tasks from another gulp task? Sort of like this;

gulp.task('dev', function() {
  if (yargs.argv.minify) {
    gulp.start('css --minify');
  }
});

I need this because otherwise I have to make a sepparate task for dev and production css builds, when I could just do one task with an optional parameter like with grunt.

sgarcia.dev
  • 5,671
  • 14
  • 46
  • 80
  • I would recommend that you don't rely on a flag, and instead take advantage of gulp tasks. Gulp is not grunt, so you shouldn't use it as such. – sdgluck Jul 07 '16 at 14:34
  • you can use `gulp.pipe` to automate the tasks and pass arugments from one task to the next task. – Venkata Dorisala Jul 07 '16 at 14:37
  • How do you propose I add options to gulp tasks upon calling them @sdgluck? I find it pretty dirty to have to create a separate task when just one line of code inside the entire task changes. – sgarcia.dev Jul 07 '16 at 14:49

0 Answers0