Socket
Socket
Sign inDemoInstall

gulp-plumber

Package Overview
Dependencies
56
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gulp-plumber

Prevent pipe breaking caused by errors from gulp plugins


Version published
Weekly downloads
167K
decreased by-2.9%
Maintainers
1
Install size
819 kB
Created
Weekly downloads
 

Package description

What is gulp-plumber?

gulp-plumber is a plugin for Gulp that prevents pipe breaking caused by errors from gulp plugins. It allows you to handle errors gracefully and continue with the build process without stopping the entire task.

What are gulp-plumber's main functionalities?

Error Handling

This feature allows you to handle errors in your Gulp tasks without breaking the stream. The code sample demonstrates how to use gulp-plumber to catch errors in a Gulp task that minifies JavaScript files using gulp-uglify.

const gulp = require('gulp');
const plumber = require('gulp-plumber');
const uglify = require('gulp-uglify');

gulp.task('scripts', function() {
  return gulp.src('src/js/*.js')
    .pipe(plumber())
    .pipe(uglify())
    .pipe(gulp.dest('dist/js'));
});

Custom Error Handler

This feature allows you to define a custom error handler. The code sample shows how to use gulp-plumber with gulp-notify to display a notification when an error occurs in a Gulp task that processes CSS files.

const gulp = require('gulp');
const plumber = require('gulp-plumber');
const notify = require('gulp-notify');

gulp.task('styles', function() {
  return gulp.src('src/css/*.css')
    .pipe(plumber({
      errorHandler: notify.onError('Error: <%= error.message %>')
    }))
    .pipe(gulp.dest('dist/css'));
});

Other packages similar to gulp-plumber

Readme

Source

:monkey: gulp-plumber

NPM version Build Status Dependency Status

Prevent pipe breaking caused by errors from gulp plugins

This :monkey:-patch plugin is fixing issue with Node Streams piping. For explanations, read this small article.

Briefly it replaces pipe method and removes standard onerror handler on error event, which unpipes streams on error by default.

Usage :monkey:

First, install gulp-plumber as a development dependency:

npm install --save-dev gulp-plumber

Then, add it to your gulpfile.js:

var plumber = require('gulp-plumber');
var coffee = require('gulp-coffee');

gulp.src('./src/*.ext')
	.pipe(plumber())
	.pipe(coffee())
	.pipe(gulp.dest('./dist'));

API :monkey:

:monkey: plumber([options])

Returns Stream, that fixes pipe methods on Streams that are next in pipeline.

options

Type: Object / Function Default: {}

Sets options described below from its properties. If type is Function it will be set as errorHandler.

options.inherit

Type: Boolean Default: true

Monkeypatch pipe functions in underlying streams in pipeline.

options.errorHandler

Type: Boolean / Function Default: true

Handle errors in underlying streams and output them to console.

  • function passed - it will be attached to stream on('error').
  • false passed - error handler will not be attached.
  • undefined - default error handler will be attached.

plumber.stop()

This method will return default behaviour for pipeline after it was piped.

var plumber = require('gulp-plumber');

gulp.src('./src/*.scss')
    .pipe(plumber())
    .pipe(sass())
    .pipe(uglify())
    .pipe(plumber.stop())
    .pipe(gulp.dest('./dist'));

License :monkey:

MIT License

Keywords

FAQs

Last updated on 09 Feb 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc