dowjones / gulp-bundle-assets

Create static asset (js, css) bundles from a config file: a common interface to combining, minifying, revisioning and more
MIT License
133 stars 36 forks source link

handle watch stream errors gracefully #31

Closed chmontgomery closed 9 years ago

chmontgomery commented 10 years ago

Currently, when running bundle.watch and a file fails to compile (coffee, less, sass, etc), the stream stops with an error. The watch task should instead continue to still run, not bundle the file and log the error.

roberto commented 9 years ago

:+1:

chmontgomery commented 9 years ago

Unfortunately I can't figure out a good way to catch stream errors across the board due to a couple issues inherent in node streams:

  1. on('error' does not return the Vinyl file errored on, just the error.
  2. You cannot conditionally handle an error... either you handle it or you don't. If you do handle it, you're put outside the context of the pipe and therefore don't have access to your context, e.g. whether this stream is a watch or a regular bundle.

Unless someone else has a better idea, I think I'm going to punt on this issue and only add some documentation on how to handle this problem in your custom transforms.

chmontgomery commented 9 years ago

This should be handled properly now as part of PR #47. Please pull down v2.19.0 and let me know how it works for you!