UNPKG

gulp-error-notifier

Version:

Notify about errors from gulp plugins and streams

80 lines (59 loc) 2.15 kB
# gulp-error-notifier [![NPM version][npm-image]][npm-url] Notify about errors from gulp plugins and streams via desktop notifications of [node-notifier]. ## Install ```shell npm install --save-dev gulp-error-notifier ``` ## Usage ```javascript var gulp = require('gulp'); var errorNotifier = require('gulp-error-notifier'); var jade = require('gulp-jade'); gulp.src('./src/*.jade') .pipe(errorNotifier()) .pipe(jade()) .pipe(gulp.dest('./dist')); ``` ## API ### errorNotifier() [Plumber] stream with [`notify`](#errornotifiernotifyerror) as [`errorHandler`][plumber-handler]. ### errorNotifier.notify(error) Logs `error` to console and displays `error` notification. ```javascript var notify = require('gulp-error-notifier').notify; notify(new Error('Something happened!')); ``` ### errorNotifier.handleError(stream) Notifies on `stream` `'error'` event and stops it from further executing. To be used with [SASS] and [Browserify]. ```javascript var gulp = require('gulp'); var errorNotifier = require('gulp-error-notifier') var sass = require('gulp-sass'); gulp.src('./src/*.scss') .pipe(errorNotifier.handleError(sass())) .pipe(gulp.dest('./dist')); ``` ## Examples For detailed executable examples look at [`examples/gulpfile.babel.js`][example-gulpfile]. ```shell cd examples npm install gulp --tasks gulp example # run specific example ``` ## Contributing All contributions are welcome. Make a pull request or open an [issue]. ## License [MIT License](https://en.wikipedia.org/wiki/MIT_License) ![](https://techburg.io/image.gif) [npm-url]: https://npmjs.org/package/gulp-error-notifier [npm-image]: https://img.shields.io/npm/v/gulp-error-notifier.svg [node-notifier]: https://github.com/mikaelbr/node-notifier [plumber]: https://github.com/floatdrop/gulp-plumber [plumber-handler]: https://github.com/floatdrop/gulp-plumber#optionserrorhandler [sass]: https://github.com/dlmanning/gulp-sass [browserify]: http://browserify.org/ [example-gulpfile]: https://github.com/feradjs/gulp-error-notifier/blob/master/examples/gulpfile.babel.js [issue]: https://github.com/feradjs/gulp-error-notifier/issues/new