Skip to content
This repository has been archived by the owner on Apr 26, 2023. It is now read-only.

Gulp error while watching requires restart of play application #6

Open
svenwiegand opened this issue Mar 25, 2016 · 1 comment
Open

Comments

@svenwiegand
Copy link

When running the play application using run, gulp watch is called by sbt-play-gulp. If gulp causes an error e.g. due to a JavaScript syntax error, gulp watch is finished. In this scenario I need to stop the play application and rerun it, to make watching work again.

As it is common, that syntax errors in JavaScript appear I would prefer some kind of loop, so that gulp watch is started again after it terminated unexpectedly, as long as the play application is running.

@udalrich
Copy link

You can work around this with something like this:

browserify().transform('babelify', { ...}).
      bundle().
      on('error', function (err) {
          console.error('Error running browserify', err.message);
      }).
     pipe(fs.createWriteStream('dist.main.js'));

You will probably want to versions: on with on('error') for gulp watch and one without it for making the file that is actually distributed, as otherwise your build will succeed with an empty output file when you have an error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants