Monday, 20 June 2011

CoffeeScript Development in 3 mintutes

Any obvious reference to coffee needs a picture
The idea of CoffeeScript just sounds great me. I like the idea of compiling decent JavaScript from code you can actually read. But what do you do if you have no Node.js available to compile it?

Well the answer is to compile to JS at runtime. However, I had an awful time getting the right setup to get going. If you are interested in playing with CoffeeScript where Node.js is not available (I'm using it in work to show what it's capable of) then just follow these instructions.

Create a directory to work in and inside that create an index.html file thus:

<!DOCTYPE html>
    <title>CoffeeScript Demo</title>
    <script data-main="scripts/requirements" 
    <h1>CoffeeScript Demo</h1>

and a directory called 'scripts' into which you put the following.


  • And a file called containing:
square = (x) -> x * x
alert square 42

That's it!

Now load the index.html page into your browser and the CoffeeScript code should execute.

Of course you will now have to go away and read the docs so that you know why that worked, but then so will I.


  1. kassa register

    Vi erbjuder Kvalité och snabb service och vet att det är mycket viktigt att få saker gjort snabbt , därför kan vi erbjuda service avtal Från 99:-/mån så du får snabbt på plats service (även distans avtal)och så ser vi till att du alltid håller ditt kassasystem uppdaterad med den nyaste programvaran!

    Kontakt información:

    Norra Ågatan 5 A Arboga Västmanland 732 31
    teléfono: 0589-10031