gulp-options
Add options parameters in Gulp to be used like:
gulp build --myopt1 --myopt2 --myopt3=val
Install
npm install gulp-options
Example
gulpfile.js
var gulp = require('gulp');
var options = require('gulp-options');
gulp.task('mytask', function() {
if (options.has('prod')) {
return gulp.src('src/**/*.*').pipe(gulp.dest('release/'));
} else if (options.has('debug')) {
return gulp.src('src/**/*.*').pipe(gulp.dest('debug/'));
} else {
return gulp.src('src/**/*.*').pipe(gulp.dest('dev/'));
}
if (options.has('env')) {
const env = options.get('env');
return gulp.src('src/**/*.*').pipe(gulp.dest(`${env}/`));
}
});
gulp commands with example gulpfile.js
gulp mytask --prod
gulp mytask --debug
gulp mytask --env=customenv
gulp mytask