Introduction :-
CoffeeScript is a programming language that compiles to JavaScript.You can write the client -side
code in coffee script but still have the browser execute the resulting javascript.
Coffee script is built on the top of java script .As it complie to the javascript you can run with any technology like php,Ruby,python,java,.Net,etc or use with technology such as Node.js for server application.
It was developed by Jeremy Ashkenas on december 13,2009.The first compiler was written in
Ruby.On February 21,2010 he committed the version 0.5 that replace the ruby complier with a self
hosting version in Coffee script.
Advantage :
1-If we are using the coffee script then we can cut 30 %-40% of code that we write in java script.
2- Provide the simple syntax for expressing the function.
3- Use whitespace as a way to organize blocks of code.
4- Supplies class based inheritance functions.
Disadvantage:
1-It is very sensative to white space.
2-coffee script compiler provide very rudimentary diagnostic information in case of error
Installation:
To install the coffee script first of all you have to install the node.js and npm(Node Pakage manager) in your system.Then you can install the coffee script by running the below command
npm install -g coffee-script
here in the above command g is stand for global if you want to install the coffee-script globally then use -g at the installation process
Below is the few command that are usefull in coffee-script compilation
-c, –compile compile a .coffee file into a java script file of the same name
-m, –map generate the source map alongside with the compile java script.
coffee –compile –output lib/src compile a directry tree of coffee file into src parallel tree of .js
Coffee-script in web
A:
B:
C: