Getting Started With CoffeeScript
Friday, 20th April 2012
There are lots of examples and snippets online, but when I came to properly use CoffeeScript on Windows to rage some code I found that there wasn't a joined up list of what I needed to do - so here it is.
You can download node.js from the official node.js website. Download it. Install it. Done.
Download coffee for node.js
If you want to make life a bit easier, register the path to node.js as an environment variable. This means you don't need to keep typing the full path, which will be the equivalent on your machine of:
You can do this in Start > Computer > Properties > Advanced > Environment Variables. Add "node" with a value of "c:/Program Files/nodejs" (check your file system for the exact path - it will contain node.exe
Now you have made your life easier, you can install coffee for node.js with the following command, so open command prompt and type:
npm install -g coffee-script
Take a note of the path that the command outputs, and add an environment variable for coffee too - "coffee" with a value of the path you noted from the above command.
Write Some Code
cd c:\path\to\your\project\ coffee --output js/ --compile src/