Now I know I’ve spoken slightly poorly of CoffeeScript in the past, but I’ve been getting into it a bit more recently on some small libraries I’ve been writing for Node. Turns out, it’s really easy to write parts of your Node applications in CoffeeScript and have them automatically compiled for you.

First, add “coffee-script” to your dependencies in package.json (definitely specify a real version instead of using *):

{
  ...
  "dependencies": {
    "coffee-script": "*"
  }
  ...
}

And then, any time you need a file that’s written in CoffeeScript, just make sure you have require “coffee-script” before requiring it:

require("coffee-script");
require("./something_in_coffeescript"); // something_in_coffeescript.coffee

And off you go!