composer

API-first task runner with three methods: task, run and watch.

composer

API-first task runner with three methods: task, run and watch.

Install with npm

$ npm i composer --save
var Composer = require('composer');

Composer

Composer constructor. Create a new Composer

Example

var composer = new Composer();

.task

Register a new task with it's options and dependencies.

Options:

  • deps: array of dependencies
  • flow: How this task will be executed with it's dependencies (series, parallel, settleSeries, settleParallel)

Params

  • name {String}: Name of the task to register
  • options {Object}: Options to set dependencies or control flow.
  • deps {String|Array|Function}: Additional dependencies for this task.
  • fn {Function}: Final function is the task to register.
  • returns {Object}: Return this for chaining

Example

composer.task('site', ['styles'], function () {
  return app.src('templates/pages/*.hbs')
    .pipe(app.dest('_gh_pages'));
});

.run

Run a task or list of tasks.

Params

  • tasks {String|Array|Function}: List of tasks by name, function, or array of names/functions.
  • cb {Function}: Callback function to be called when all tasks are finished running.

Example

composer.run('default', function (errresults) {
  if (err) return console.error(err);
  console.log(results);
});

.watch

Watch a file, directory, or glob pattern for changes and run a task or list of tasks when changes are made. Watch is powered by chokidar so the glob pattern may be anything that chokidar.watch accepts.

Params

  • glob {String|Array}: Filename, Directory name, or glob pattern to watch
  • tasks {String|Array|Function}: Tasks that are passed to .run when files in the glob are changed.
  • returns {Object}: Returns this for chaining

Example

composer.watch('templates/pages/*.hbs', ['site']);
  • assemble: Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt,… more | homepage
  • generate: Project generator, for node.js. | homepage
  • template: Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template… more | homepage
  • update: Update the year in all files in a project using glob patterns. | homepage
  • verb: Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… more | homepage

Install dev dependencies:

$ npm i -d && npm test

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Jon Schlinkert

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on August 25, 2015.