AgileApps Support Wiki Pre Release

User:Aeric/HowTo:Install CoffeeScript

From AgileApps Support Wiki
1. Go to http://nodejs.org/, click [Download], do the install
--CoffeeScript requires Node.js to run the compiler
--It uses npm (node package manager) to download & install coffescript
(bundled with Node.js!)
2. In File Explorer, move the nodejs folder to C:\
--In :\Program Files, or C:\Program Files (x86) on a 64 bit system
3. Start a command shell
cd c:\nodejs
set path=%PATH%;%CD%
setx path "%PATH%
--that command modifies the registry, so you don't have to go find env variables!
4. Install Coffeescript
npm install -g coffee-script
--installation folder is created:
C:\Users\{user}\AppData\Roaming\npm\node_modules\coffee-script
5. Start a new shell,so the commands in coffee-script/bin can be used
6. In the command shell, verify the install:
coffee
--after a short pause, you see the prompt for the coffe-script interpreter
--coffee>
--Press Ctrl+C to exit the interpreter
--Try out the "instant eval" option for a one-line command:
coffee -e "console.log num for num in [10..1]"
result: Count down from 10 to 1, one value per line
7. Do a test compile
--Create a project folder
--Create a file with the initial sample code from coffeescript.org (below)
(sample.coffee)
--Compile it: coffee -c
--Resulting .js file should match the results displayed at coffeescript.org
--Notice how much cleaner and nicer it is, and much more fun it will be to work with!
8. Clean up the build environment
--create src/ and lib/ subfolders
--move the .coffee file to src/
--nuke the .js file
--Save and run the following command (put it build.cmd):
coffee -c -o lib/ src/
9. Other options to explore:
--watch a file and recompile every time it is saved
coffee -w -c myfile.coffee
--concatenate a list of files into a single script
coffee --join project.js --compile src/*.coffee
--watch and recompile an entire project
coffee -o lib/ -cw src