3

I'm using gulp and running nodemon from a task. Everytime it detects changes it

  • restarts the server
  • runs "build" task

Yup in that order. Couldn't figure out how to kick "build" task before nodemon's restart happens (setting delay param didn't help).

nodemon = require "gulp-nodemon"  
runSequence = require 'run-sequence' # couldn't figure out how to run gulp task
                                     # from another task, so ended up using this

nodemon(
    script:'server.js'
    watch: 'src/**/*.*'
).on "restart" (files)->
    runSequence "build"  

Now, my problem is - when something happens during build, something that I apparently can't really control (let's say Jade files fail to compile), process throws uncaughtException and crashes. What I need though, to restart nodemon, and keep trying building until failing jade file fixed.

I've tried running "build", followed with nodemon in process.on 'uncaughtException', it kinda works, but then nodemon stops watching files and can't recognize changes anymore.

Can you guys advise.

iLemming
  • 34,477
  • 60
  • 195
  • 309
  • You can maybe have a look to http://stackoverflow.com/questions/23971388/prevent-errors-from-breaking-gulp-watch/23973536#23973536 – Preview Jul 21 '14 at 22:37

0 Answers0