Difference between revisions of "User:Aeric/HowTo:Install CoffeeScript"
From AgileApps Support Wiki
imported>Aeric (Created page with "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 & instal…") |
imported>Aeric |
||
Line 1: | Line 1: | ||
1. Go to http://nodejs.org/, click [Download], do the install | :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:\ | |||
:2. In File Explorer, move the nodejs folder to C:\ | |||
3. Start a command shell | :: --In :\Program Files, or C:\Program Files (x86) on a 64 bit system | ||
cd c:\nodejs | |||
set path=%PATH%;%CD% | :3. Start a command shell | ||
setx path "%PATH% | ::cd c:\nodejs | ||
::set path=%PATH%;%CD% | |||
4. Install Coffeescript | ::setx path "%PATH% | ||
npm install -g coffee-script | ::: --that command modifies the registry, so you don't have to go find env variables! | ||
:4. Install Coffeescript | |||
5. Start a new shell,so the commands in coffee-script/bin can be used | ::npm install -g coffee-script | ||
6. In the command shell, verify the install: | ::: --installation folder is created: | ||
coffee | ::: 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 | |||
7. Do a test compile | ::: --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 | |||
8. Clean up the build environment | :: --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 |
Latest revision as of 18:51, 31 January 2012
- 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
- npm install -g 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
- coffee
- 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
- --watch a file and recompile every time it is saved