gulp-options
v1.1.1
Published
Allow to pass gulp options and retreive them
Downloads
5,772
Readme
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')) {
// Do prod stuff...
return gulp.src('src/**/*.*').pipe(gulp.dest('release/'));
} else if (options.has('debug')) {
// Do debug stuff..
return gulp.src('src/**/*.*').pipe(gulp.dest('debug/'));
} else {
// Do default stuff..
return gulp.src('src/**/*.*').pipe(gulp.dest('dev/'));
}
// Get option value
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 # source files moved to release/ folder
gulp mytask --debug # source files moved to debug/ folder
gulp mytask --env=customenv # source files moved to customenv/ folder
gulp mytask # source files moved to dev/ folder