M
M
Maxim Ramenskiy2015-05-15 15:05:04
gulp.js
Maxim Ramenskiy, 2015-05-15 15:05:04

How to throw an error when executing Gulp without stopping it?

Here is gulpfile.js

var gulp = require('gulp'),
  less = require('gulp-less');

gulp.task('less', function() {
  gulp.src('css/style.less')
    .pipe(less())
    .pipe(gulp.dest('css/'));
});

gulp.task('watch', function() {
  gulp.watch('css/*.less', ['less']);
})

gulp.task('default', ['watch']);

If I make a mistake in the syntax, then an error is displayed in the console and gulp stops.
Is it possible to make it so that it would show an error notification in a separate window and not have to run gulp again in the console.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey delphinpro, 2015-05-15
@m_ramenskiy

i use gulp-plumber it catches errors and prints them to the terminal without stopping the task.

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

gulp.task('less', function() {
  gulp.src('css/style.less')
    .pipe(plumber())
    .pipe(less())
    .pipe(gulp.dest('css/'));
});

M
Maxim Ramenskiy, 2015-05-15
@m_ramenskiy

Thanks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question