gulp-taskfromstreams
Forward stream errors to a task
Defines a utility function that can be used to wrap a sequence of gulp steps to ensure that any error will result in a task failure and not a hang or a crash.
Install
$ npm install --save-dev gulp-taskfromstreams
Usage
var gulp = ;var jslint = ;var taskFromStreams = ; gulp
API
Assuming:
var taskFromStreams = ;
taskFromStreams([options], streamsProvider)
Takes a function that generates an array of streams (streamsProvider
) and produces an orchestrator-compatible task function. Each stream in the resulting array is piped into the next while any errors in any stream will result in a failed task.
options
Type: Object
Default: no options
Options that customize behaviour of taskFromStreams
function.
options.beepOnError
Type: Boolean
Default: use global setting
When truthy, every time taskFromStreams
function detects a stream error, it will play system "beep" sound. This audible feedback is useful (for example) when running a watch task whose window is hidden behind other windows.
If not specified, global setting will be used. If an environment variable GULP_BEEPONERROR
is defined and has truthy value, system "beep" sound will be played, no sound will be played otherwise.
options.streamsProvider
Type: Function
Default: use streamsProvider
parameter
Alternative way of passing streamsProvider
function to taskFromStreams
. If both streamsProvider
parameter and options.streamsProvider
are specified, parameter will be used.
streamsProvider
Type: Function
Default: no default, required
A function that will be called to determine streams that make up the task. Must return non-empty array. Each item in the array must be a valid stream. All the streams will be piped together (e.g. if an array [s1, s2, s3,..., sN]
is returned, equivalent of s1.pipe(s2).pipe(s3). ... .pipe(sN)
will be performed).
Contributing
-
Clone git repository
-
npm install
(will install dev dependencies needed by the next step) -
npm start
(will start a file system watcher that will re-lint JavaScript and JSON files + re-run all tests when change is detected) -
Make changes, don't forget to add tests, submit a pull request.
License
MIT © Pandell Technology