Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NodeJS + CoffeeScript Workflow

I have recently started learning nodeJS. Being a long-time coffeescript lover I naturally decided to use it along with node. Writing long-running processes with node I found myself restarting the program frequently. After a quick google I found node-supervisor. Node-supervisor simply watches the current directory for file changes and restarts your app for you automatically.

Before I started using supervisor I was using coffeescript with the --watch option to automatically recompile my coffescripts when they changed.

So the problem is this, supervisor and the coffeescript recompiler don't play nice together.

  • First I run coffee --compile --watch .
  • Then in a new terminal I run supervisor app.js

After that supervisor keeps restarting my app forever, even when there has been no changes to the source files.

So the question is this, what is your workflow for working with nodeJS and CoffeeScript?

like image 313
giodamelio Avatar asked Jun 07 '12 21:06

giodamelio


1 Answers

What you are doing is some kind of redundant.

Here are some hints:

  • after installing CoffeeScript you have an executable called coffee so you can do (no need to compile your coffee-script files):

    coffee yourfile.coffee

  • how to combine this with supervisor?
    if you would have read the Readme on the Github page you would have noticed that supervisor can execute CoffeeScript files, too. All you need to do is:

    supervisor yourfile.coffee

like image 126
TheHippo Avatar answered Nov 11 '22 06:11

TheHippo