gulp: Continue gulp on error?

I have the following gulp js code using the gulp-coffee plugin:


gulp.src('./**/*.coffee')
  .pipe(coffee({bare: true}))
    .on('error', gutil.log)
    .on('error', gutil.beep)
  .pipe(gulp.dest(destDir));

Whenever gulp-coffee throws an error (e.g. invalid coffee syntax), it stops the rest of valid coffee files from ‘piping’ through; even though the error is caught.

To clarify this, here is a sample file queued via gulp.src:

A.coffee (processed)
B.coffee (error and stops the rest of the stream)
C.coffee (not processed)

Is there a way to ‘continue’ the stream?

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 42 (39 by maintainers)

Most upvoted comments

Isn’t --continue supposed to do this? It doesn’t, but isn’t it supposed to?

@Contra I put together a testbed at: https://github.com/Dashed/gulp-coffee-sandbox to demonstrate the issue.

Just npm install and gulp.

There are four coffeescript files:

subdir/a.coffee
subdir/b.coffee
subdir/c.coffee
d.coffee

The file b.coffee contains invalid coffeescript. Only c.coffee would not get compiled.