gulp-options
Advanced tools
Comparing version 1.0.2 to 1.1.0
11
index.js
@@ -7,6 +7,7 @@ /** | ||
read: function(argv) { | ||
var optionsClean = []; | ||
var optionsClean = {}; | ||
argv.slice(2, argv.length).forEach(function(p) { | ||
if (p.indexOf('--') === 0 && p.length !== 2) { | ||
optionsClean.push(p.replace('--', '')); | ||
[param, value] = p.replace('--', '').split('='); | ||
optionsClean[param] = (value) ? value : ''; | ||
} | ||
@@ -21,4 +22,8 @@ }); | ||
} | ||
return (this.options.indexOf(param) !== -1); | ||
return (Object.prototype.hasOwnProperty.call(this.options, param)); | ||
}, | ||
get: function(param) { | ||
return (this.has(param)) ? this.options[param] : undefined; | ||
} | ||
}; |
{ | ||
"name": "gulp-options", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Allow to pass gulp options and retreive them", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# gulp-options | ||
Add options parameters in Gulp to be used like: | ||
```bash | ||
gulp build --myopt1 --myopt2 | ||
gulp build --myopt1 --myopt2 --myopt3=val | ||
``` | ||
@@ -35,2 +35,8 @@ ## Install | ||
} | ||
// Get option value | ||
if (options.has('env')) { | ||
const env = options.get('env'); | ||
return gulp.src('src/**/*.*').pipe(gulp.dest(`${env}/`)); | ||
} | ||
}); | ||
@@ -42,5 +48,6 @@ | ||
```bash | ||
gulp mytask --prod # source files moved to release/ folder | ||
gulp mytask --debug # source files moved to debug/ folder | ||
gulp mytask # source files moved to dev/ folder | ||
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 | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16313
9
25
52