I'd like to prepare a different versions of a software by passing a special parameters in gulp task.
I've created tasks for css, js, etc. and made one to run then all:
gulp.task('compile', ['css', 'twig', 'js', ....]);
How to pass a parameter which will be passed also to the subtasks? Is there any way to do that?
I'd like to run e.g.:
gulp compile --mode A
and
gulp compile --mode B
Thank you in advance.
For this, I'm use yargs module
in gulpfile use:
var mode = require("yargs").argv.mode;
run task with:
gulp compile -mode A
In your [css/twig/etc] tasks use:
gulp.task("css", function(){
var cssSRC = "./src/" + mode + "/*.css";
gulp.src(cssSRC)
...
...
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With