Skip to content

mdellanave/gulp-parameterized

 
 

Repository files navigation

npm Version Build Status Coverage Status Dependency Status devDependency Status Code Climate Codacy Badge

gulp-parameterized

Parameterize gulp tasks.

NOTE: REQUIRES GULP 4.0

See CHANGELOG for latest changes.

Installation

npm install --save-dev gulp-parameterized

Usage

You can accept parameters in a task by wrapping the task function in parameterized():

var parameterized = require('gulp-parameterized');

gulp.task('hello', parameterized(function(cb, params) {
  console.log('hello ' + params.name + '!');
  cb();
}));

You can then pass parameters to a task on the command line:

$ gulp hello --name world
[23:43:51] Using gulpfile ~/hello-example/gulpfile.js
[23:43:51] Starting 'hello'...
hello world!
[23:43:51] Finished 'hello' after 1.98 ms

Use parameterized.series() and parameterized.parallel() instead of gulp.series() and gulp.parallel() if you want to call another task in your gulpfile and pass parameters to it:

gulp.task('hello-world', parameterized.series('hello --name world'));

gulp.task('hello-gulp', parameterized.series('hello --name gulp'));

You can then invoke the hello-gulp task on the command line:

$ gulp hello-gulp
[23:49:38] Using gulpfile ~/hello-example/gulpfile.js
[23:49:38] Starting 'hello-gulp'...
[23:49:38] Starting 'hello'...
hello gulp!
[23:49:38] Finished 'hello' after 1.28 ms
[23:49:38] Finished 'hello-gulp' after 4.91 ms

License

MIT

About

Parameterize gulp tasks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%