Skip to content
This repository was archived by the owner on Aug 14, 2026. It is now read-only.
This repository was archived by the owner on Aug 14, 2026. It is now read-only.

compatibility with lazypipe #16

Open

Description

@cyrusdavid

It works well!

gulp.task('less', function() {
  return gulp.src('css/*.less', { cwd: 'app/**' })
  .pipe($.plumber())
  .pipe($.less())
  .pipe(gulp.dest('.tmp'));
});
[gulp] Starting 'less'...
[gulp] Plumber found unhandled error: [gulp] Error in plugin 'gulp-less': .make-
grid-columns is undefined in file bower_components\bootstrap\less\
grid.less line no. 48
[gulp] Finished 'less' after 314 ms

But with lazy pipe:

var less = lazypipe()
  .pipe($.less)
  .pipe(gulp.dest, '.tmp');

gulp.task('less', function() {
  return gulp.src('css/*.less', { cwd: 'app/**' })
  .pipe($.plumber())
  .pipe(less());
});
[gulp] Starting 'less'...
[gulp] 'less' errored after 317 ms .make-grid-columns is undefined in file bower_components\bootstrap\less\grid.less line no. 48

I also tried putting plumber inside the lazy pipe:

var less = lazypipe()
  .pipe($.plumber)
  .pipe($.less)
  .pipe(gulp.dest, '.tmp');

gulp.task('less', function() {
  return gulp.src('css/*.less', { cwd: 'app/**' })
  .pipe(less());
});
[gulp] Starting 'less'...
[gulp] 'less' errored after 317 ms .make-grid-columns is undefined in file bower_components\bootstrap\less\grid.less line no. 48

Activity

  1. floatdrop commented on Jun 12, 2014

    @floatdrop
    Owner

    Last code snippet is working fine for me, but with small addition:

    var gulp = require('gulp');
    
    var lazypipe = require('lazypipe');
    var gless = require('gulp-less');
    var plumber = require('gulp-plumber');
    
    var less = lazypipe()
      .pipe(plumber)
      .pipe(gless)
      .pipe(gulp.dest, 'tmp');
    
    gulp.task('default', function() {
      return gulp.src('css/*.less')
        .pipe(less()
            .on('error', function (err) {
                console.log(err);
            }));
    });

    Lazystream uses stream-combiner inside, which returns one stream with one error handler for all underlying streams, so you get error object with information, from which stream it comes from:

    [gulp] Using gulpfile /Users/floatdrop/gulp-lazypipe/gulpfile.js
    [gulp] Starting 'default'...
    { plugin: 'gulp-less',
      showStack: false,
      name: 'Error',
      message: 'Unrecognised input in file /Users/floatdrop/gulp-lazypipe/css/1.less line no. 12',
      fileName: '/Users/floatdrop/gulp-lazypipe/css/1.less',
      lineNumber: 12 }

    Gulp-plumber will not add it own error handler, if there is one already defined.

  2. avanderhoorn commented on Jun 29, 2014

    @avanderhoorn

    Even though the reference has come through to this issue, I've also run into this issue with the following floatdrop/gulp-watch#52.

  3. mgcrea commented on Oct 10, 2014

    @mgcrea

    Encountering this as well. Adding .on() to the lazypipe instance is not an option in my case (exporting lazypipes as a node_module). @floatdrop Would having an option to force plumber attaching it's own error handler (even if there is already one attached) fix this?

  4. gligoran commented on Sep 23, 2015

    @gligoran

    If anyone is still having problem with this, I found a work-around reading this article: http://lkrnac.net/blog/2014/10/watch-file-changes-propagate-errors-gulp. It provides this explanation:

    Lazypipe isn’t integrated with gulp-plumber, so it is needed also in sub-pipe.

    So, to make plumber not crash, include it in all of your pipes. It's not pretty, as there's all of a sudden a lot plumbers everywhere, but it works.

    @floatdrop: Are there any dangers of not calling plumber.stop()?

  5. floatdrop commented on Sep 23, 2015

    @floatdrop
    Owner

    @gligoran nope, it just restores original .pipe function, nothing else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions