How to manage files while there are Jade and Stylus to compile?

I usually white pages in Jade, Stylus and CoffeeScript, so I use a shell script to watch them all and compile. And use a shell script with pkill -f to kill them after coding.

But there's problems:

  • if I call this script from another directory, it fails
  • if I forget to run the second script, it will just run,

http://gitcafe.com/jiyinyiyong/weibo-list/blob/master/watch/watch.sh#code

jade -O ../page/ --pretty -w ../src/index.jade &
jade -O ../page/ --pretty -w ../src/login.jade &
coffee -o ../page/ -wbc ../src/handle.coffee &
coffee -o ../page/ -wbc ../src/config.coffee &
stylus -o ../page/ -w ../src/page.styl &
doodle ../page/ ../server.coffee &
node-dev ../server.coffee &

Is there a better solution to manage these files?

You can use a Cakefile to automate such tasks.

My Cakefile. I use the same one for all my projects.

For more info, see cake.coffee.