4

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.

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.