gulp common plug-ins use the gulp-plumber

More gulp common plug-ins use please visit: gulp common plug-ins summary


gulp-plumber This is a plug-in to prevent the wrong gulp interruption caused by the pipeline, plumber can prevent gulp plug-in error occurs that causes a process to exit with an error log.

Greater use of the document, please click visit gulp-plumber tool official website .

installation

npm install --save-dev gulp-plumber

use

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

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

API

plumber([options])

Back Stream, which conduit pipe repair method on the next Stream.

** options **

Type: Object/ Functiondefault:{}

According to its properties the following options. If it is of the type Function, it is set to errorHandler.

options.heritit

Type: BooleanDefault:true

Monkeypatch pipefunction on the basis of the flow conduit.

options.errorHandler

Type: Boolean/ Function
default:true

Processing errors elementary stream and outputs it to the console.

  • function: It is attached to the stream on('error').
  • false : Error handler will not be attached.
  • true : Attach default error handler.

plumber.stop()

This method returns the default behavior of the pipeline after the tunnel.

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

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

Guess you like

Origin www.cnblogs.com/jiaoshou/p/12032886.html