JSPM

  • Created
  • Published
  • Downloads 10598
  • Score
    100M100P100Q150051F
  • License MIT

Adds help task to gulp and the ability to provide help text to your custom gulp tasks

Package Exports

  • gulp-help

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-help) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gulp-help NPM version Build Status

Adds help task to gulp and the ability to provide help text to your custom gulp tasks

Install

$ npm install --save-dev gulp-help

Usage

Before defining any tasks, add gulp help to the gulp instance

// gulpfile.js
require('gulp-help')(gulp);

Next, define help text for each task

// gulpfile.js
gulp.task('lint', 'Lints all server side js', function () {
    gulp.src('./lib/**/*.js')
      .pipe(jshint(jshintrcPath))
      .pipe(jshint.reporter(stylish))
      .pipe(jshint.reporter('fail'));
});

Now show that help via gulp help

$ gulp help
[gulp] Running 'help'...

Usage
  gulp [task]

Available tasks
  help Display this help text.
  lint Lints all server side js

[gulp] Finished 'help' in 607 μs

Hide Tasks

You can optionally hide a target from showing up in the help menu by passing false as the help argument, e.g.

gulp.task('task-hidden-from-help', false, function () {
  // ...
});

Aliases

You can optionally add aliases to your targets by supplying an object with an aliases array, e.g.

gulp.task('version', 'prints the version.', [], function() {
  // ...
}, {
  aliases: ['v', 'V']
});

which results in

[gulp] Starting 'help'...

Usage
  gulp [task]

Available tasks
  help     Display this help text.
  version  prints the version. Aliases: v, V

[gulp] Finished 'help' after 928 μs

Override default help message

require('gulp-help')(gulp, { description: 'you are looking at it.', aliases: ['h', '?'] });

=>

node_modules/.bin/gulp
node_modules/.bin/gulp help
node_modules/.bin/gulp h
node_modules/.bin/gulp ?

=>

[gulp] Starting 'help'...

Usage:
  gulp [task]

Available tasks:
  help     you are looking at it. Aliases: h, ?

[gulp] Finished 'help' after 1.05 ms

Post-help callback

You can define a function to run after the default help task runs.

require('gulp-help')(gulp, {
  afterPrintCallback: function(tasks) {
    console.log(tasks);
  }
});

License

MIT © Chris Montgomery