It automatically injects commandline arguments into a gulp's task definition arguments.
It accepts parameters after '--'. Parameters without any value will be treated as boolean flag.
gulp build --myparam 123 --booleanParam
npm install gulp-param
var gulp = require('gulp-param')(require('gulp'), process.argv);
gulp.task('dep', function(debug) {
console.log(debug); // => true
});
gulp.task('build', ['dep'], function(debug, tag) {
console.log(debug); // => true
console.log(tag); // => 'v1.0.0'
});
// $ gulp build --debug --tag v1.0.0
gulp
a instance of gulp.cmdArgs
arguments from command line. In most cases it would beprocess.argv
gulpCallbackName
name of methodargument which will be use to inject async gulp callback. It is an option parameter. If you not defined it a default value would be set tocallback
- returns wrapped gulp instance with enabled param injection.