Thursday, March 15, 2012

Compile Coffeescript to Javascript

Many friends not familiar with coffeescript yet, but Rails 3.2 is already generating coffee script by default when you do scaffold. So far it is OK for them to achieve something by "copy and paste" from internet. However, it is hard for them to modify the script they got.


So, one way is ... use Javascript by changing the extension from .js.coffee to .js. But human has to learn, right? Here is the second way: learn by comparing coffee script and javascript implemtation.


Compile CoffeeScript to Javascript inside Aptana Studio

[Commands] -> [CoffeeScript] -> [Run] -> [Compile and Display JS]

a corresponding .js file will be generated and then you can see how each line of coffee script is compiled into javascript.



if there is error saying coffee command not found, just go ahead and install coffee-script library for your OS.

e.g. in MacOSX, brew install coffee-script


1 comment:

  1. Kvittorullar

    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
    Site: www.kassanetto.se

    ReplyDelete