Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🍺 Better Error Reporting for Gulp

License

NotificationsYou must be signed in to change notification settings

lordgiotto/gulp-beer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-beer

gulp-beer: better error reporting.

gulp-beer is a simple error handler function that provides some extra features:

  • Interactive System Notification (thanks tonode-notifier)
  • Custom Server for Errors (opened on notification click) that display all your errors in a more pleasent and straightforward way.

Interactive System Notificationsystem notification

Custom Server for Errorserror server

Installation

$ npm install --save-dev gulp-beer

Usage

Require gulp-beer in yourgulpfile.js:

vargulpBeer=require('gulp-beer');

than simply pass required function as error handler function wherever you like:

gulp.src('*')// stream error.on('error',gulpBeer)// Plumber.pipe(plumber({errorHandler:gulpBeer}))// Other error listener.pipe(sass().on('error',gulpBeer))

You can also call it manually if an error object must be handled

varcustomFunction(err,result){if(err)gulpBeer(err);}

(!!) Start error server (!!)

Since error server prevents the gulp process to finish, it has to be started manually when needed (usually when performing a watching task).

Error Handler function expose the server object, so you can do:

gulpBeer.server.start()// to start the error server
gulpBeer.server.stop()// to stop the error server

A simple usage example:

vargulp=require('gulp');vargulpBeer=require('gulp-beer');varplumber=require('gulp-plumber');varsass=require('gulp-sass');functionbuild(){returngulp.src('./src/css/*.scss').pipe(plumber({errorHandler:gulpBeer})).pipe(sass()).pipe(gulp.dest('./dist/css'));}gulp.task('build',build);gulp.task('watch',function(){gulpBeer.server.start();gulp.watch('./src/css/*.scss',['build']);});

Otherwise, if you prefer start it automatically, take a look at the option server.autostart in the "customize handler" section.

Customize Handler

If you like, you can customize the error handler function and the error server.

First of all require the custom module:

vargulpBeerFactory=require('gulp-beer/custom');

This will return a factory for the error handler function, which accepts some options as first parameter.

varerrorHandler=gulpBeerFactory(options);

Options


consoleError [function] : the function that will be used to print the error in the console.

It receives the error object as first argument, decorated with a custom property:

  • serverUrl [string | false]: the link to the custom error server related to this specific error

title [string] Title of the system notification


sound [boolean | string] Notification sound as describedhere


icon [boolean | string] Notification sound as describedhere


server [object | false] Server configuration object. Iffalse the server start will be prevented also if started manually.

Server configuration object accepts the following properties:

  • port [number] : Port on which the server will listen
  • autostart [boolean] : If true, the server will be started automatically
  • silent [boolean] : Silents server console output

About

🍺 Better Error Reporting for Gulp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp