1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00
This commit is contained in:
Jeremy Ashkenas 2011-11-08 18:12:58 -05:00
parent cebfe394ad
commit 74501f643c

View file

@ -93,7 +93,7 @@
<p>
<b>CoffeeScript is a little language that compiles into JavaScript.</b> Underneath
all of those embarrassing braces and semicolons, JavaScript has always had
all those awkward braces and semicolons, JavaScript has always had
a gorgeous object model at its heart. CoffeeScript is an attempt to expose
the good parts of JavaScript in a simple way.
</p>
@ -102,8 +102,9 @@
The golden rule of CoffeeScript is: <i>"It's just JavaScript"</i>. The code
compiles one-to-one into the equivalent JS, and there is
no interpretation at runtime. You can use any existing JavaScript library
seamlessly (and vice-versa). The compiled output is readable and pretty-printed,
passes through <a href="http://www.javascriptlint.com/">JavaScript Lint</a>
seamlessly from CoffeeScript (and vice-versa). The compiled output is
readable and pretty-printed, passes through
<a href="http://www.javascriptlint.com/">JavaScript Lint</a>
without warnings, will work in every JavaScript implementation, and tends
to run as fast or faster than the equivalent handwritten JavaScript.
</p>
@ -300,8 +301,7 @@ sudo bin/cake install</pre>
<td width="25%"><code>-i, --interactive</code></td>
<td>
Launch an interactive CoffeeScript session to try short snippets.
More pleasant if wrapped with
<a href="http://utopia.knoware.nl/~hlub/uck/rlwrap/rlwrap.html">rlwrap</a>.
Identical to calling <tt>coffee</tt> with no arguments.
</td>
</tr>
<tr>
@ -322,8 +322,8 @@ sudo bin/cake install</pre>
<tr>
<td><code>-w, --watch</code></td>
<td>
Watch the modification times of the coffee-scripts, recompiling as
soon as a change occurs.
Watch files for changes, rerunning the specified command when any
file is updated.
</td>
</tr>
<tr>
@ -368,8 +368,8 @@ sudo bin/cake install</pre>
<tr>
<td><code>-b, --bare</code></td>
<td>
Compile the JavaScript without the top-level function safety wrapper.
(Used for CoffeeScript as a Node.js module.)
Compile the JavaScript without the
<a href="#lexical_scope">top-level function safety wrapper</a>.
</td>
</tr>
<tr>
@ -410,9 +410,9 @@ Expressions
<ul>
<li>
Compile a directory tree of <tt>.coffee</tt> files into a parallel
tree of <tt>.js</tt>, in <tt>lib</tt>:<br />
<tt>coffee -o lib/ -c src/</tt>
Compile a directory tree of <tt>.coffee</tt> files in <tt>src</tt> into a parallel
tree of <tt>.js</tt> files in <tt>lib</tt>:<br />
<tt>coffee --compile --output lib/ src/</tt>
</li>
<li>
Watch a file for changes, and recompile it every time the file is saved:<br />
@ -426,6 +426,10 @@ Expressions
Print out the compiled JS from a one-liner:<br />
<tt>coffee -bpe "alert i for i in [0..10]"</tt>
</li>
<li>
All together now, watch and recompile an entire project as you work on it:<br />
<tt>coffee -o lib/ -cw src/</tt>
</li>
<li>
Start the CoffeeScript REPL:<br />
<tt>coffee</tt>
@ -2091,8 +2095,18 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
<h2>
Examples
</h2>
<p>
The <a href="https://github.com/languages/coffeescript">best list of
open-source CoffeeScript examples</a> can be found on GitHub. But just
to throw out few more:
</p>
<ul>
<li>
<b>github</b>'s <a href="http://hubot.github.com/">Hubot</a>,
a friendly IRC robot that can perform any number of useful and useless tasks.
</li>
<li>
<b>sstephenson</b>'s <a href="http://pow.cx/">Pow</a>,
a zero-configuration Rack server, with comprehensive annotated source.
@ -2108,7 +2122,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
</li>
<li>
<b>assaf</b>'s <a href="http://zombie.labnotes.org/">Zombie.js</a>,
A headless, full-stack, faux-browser testing library for Node.js.
a headless, full-stack, faux-browser testing library for Node.js.
</li>
<li>
<b>jashkenas</b>' <a href="documentation/docs/underscore.html">Underscore.coffee</a>, a port
@ -2196,19 +2210,34 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
out and keep it readable, as you can see in the examples on this page.
</li>
<li>
You can now call <tt>super</tt> in class level methods in class bodies,
and bound class methods now preserve their correct context.
</li>
<li>
JavaScript has always supported octal numbers <tt>010 is 8</tt>,
and hexadecimal numbers <tt>0xf is 15</tt>, but CoffeeScript now
also supports binary numbers: <tt>0b10 is 2</tt>.
</li>
<li>
The CoffeeScript module has been nested under a subdirectory to make
it easier to <tt>require</tt> individual components separately, without
having to use <b>npm</b>. For example, after adding the CoffeeScript
folder to your path: <tt>require('coffee-script/lexer')</tt>
</li>
<li>
There's a new "link" feature in Try CoffeeScript on this webpage. Use
it to get a shareable permalink for your example script.
</li>
<li>
The <tt>coffee --watch</tt> feature now only works on Node.js 0.6.0
and higher, but now also works properly on Windows.
</li>
<li>
Lots of small bug fixes from
<b><a href="https://github.com/michaelficarra">@michaelficarra</a></b>,
<b><a href="https://github.com/geraldalewis">@geraldalewis</a></b>,
<b><a href="https://github.com/satyr">@satyr</a></b>, and
<b><a href="https://github.com/trevorburnham">@trevorburnham</a></b>.
</li>
</ul>
</p>