Package detail

gulp-parameterized

svenschoenung552MIT0.1.1

Parameterize gulp tasks

gulp, gulp4, gulp-4, gulpfriendly

readme

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

changelog

Changelog

v0.1.0 (2016-11-27)

Features

  • Added paramsName and callbackName options
  • Show error message when requiring of gulp instance fails
  • Show warning message when requiring of gulp metadata instance fails

Bugfixes

  • Fixed the order in which params are merged. Params that are specified later should take precedence over params that were specified earlier. The order is therefore: command line params > series() and parallel() params > task default params

Documentation

  • Rewrote README to give a better introduction to accepting and passing parameters
  • Formatting fixes

Tests

  • Added tests for parameterized.series() and parameterized.parallel()
  • Added tests for parameterized options
  • Refactored existing tests

v0.0.3 (2016-11-23)

Bugfixes

  • Fixed issue where params in parameterized.task('task --param val') were not correctly parsed

Documentation

  • Minor formatting changes

Tests

  • Introduced tests for parameterized.task()

v0.0.2 (2016-11-15)

Bugfixes

  • Generate metadata for functions returned by parameterized.series() and parameterized.parallel() so that gulp --tasks can display a task tree

Documentation

  • Added CHANGLELOG.md
  • Fixed some typoes

v0.0.1 (2016-11-13)

Initial release

  • Define parameterized tasks with parameterized.task()
  • Combine parameterized tasks with parameterized.series() and parameterized.parallel()
  • Parse command line arguments with yargs