From 1ad9c61bd0512736461b08aa81dcf7fc1696620f Mon Sep 17 00:00:00 2001
From: Geoffrey Booth CoffeeScript is a little language that compiles into JavaScript. Underneath that awkward Java-esque patina, JavaScript has always had a gorgeous heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way. The golden rule of CoffeeScript is: “It’s just JavaScript”. 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 from CoffeeScript (and vice-versa). The compiled output is readable, pretty-printed, and tends to run as fast or faster than the equivalent handwritten JavaScript. The CoffeeScript compiler goes to great lengths to generate output JavaScript that runs in every JavaScript runtime, but there are exceptions. Use generator functions, Latest Version: 1.12.7 Latest 1.x Version: 1.12.7 CoffeeScript 2 is coming! It adds support for ES2015 classes, Upgrade to CoffeeScript 2! It adds support for ES2015 classes, CoffeeScript on the left, compiled JavaScript output on the right. The command-line version of The command-line version of To install, first make sure you have a working copy of the latest stable version of Node.js. You can then install CoffeeScript globally with npm: If you need to invoke one task before another — for example, running If you need to invoke one task before another — for example, running While it’s not recommended for serious use, CoffeeScripts may be included directly within the browser using While it’s not recommended for serious use, CoffeeScripts may be included directly within the browser using In fact, the little bit of glue script that runs “Try CoffeeScript” above, as well as the jQuery for the menu, is implemented in just this way. View source and look at the bottom of the page to see the example. Including the script also gives you access to The usual caveats about CoffeeScript apply — your inline scripts will run within a closure wrapper, so if you want to expose global variables or functions, attach them to the Browser Testsfor…from, or tagged template literals only if you know that your target runtimes can support them. If you use modules, you will need to use an additional tool to resolve them.
-npm install -g coffeescript
async/await, JSX, object rest/spread syntax, and JavaScript generated using ES2015+ syntax. Learn more.async/await, JSX, object rest/spread syntax, and JavaScript generated using modern syntax. Learn more.Overview
Installation
-coffee is available as a Node.js utility. The core compiler however, does not depend on Node, and can be run in any JavaScript environment, or in the browser (see Try CoffeeScript).coffee is available as a Node.js utility. The core compiler however, does not depend on Node, and can be run in any JavaScript environment, or in the browser (see Try CoffeeScript).
@@ -2441,7 +2441,7 @@ task('build:parser', 'rebuild t
dir = options.output || 'lib';
return fs.writeFile(dir + "/parser.js", code);
});
-npm install --global coffeescript
build before test, you can use the invoke function: invoke 'build'. Cake tasks are a minimal way to expose your CoffeeScript functions to the command line, so don’t expect any fanciness built-in. If you need dependencies, or async callbacks, it’s best to put them in your code itself — not the cake task.build before test, you can use the invoke function: invoke 'build'. Cake tasks are a minimal way to expose your CoffeeScript functions to the command line, so don’t expect any fanciness built-in. If you need dependencies, or async callbacks, it’s best to put them in your code itself — not the cake task.Source Maps
@@ -2450,7 +2450,7 @@ task('build:parser', 'rebuild t
“text/coffeescript” Script Tags
-<script type="text/coffeescript"> tags. The source includes a compressed and minified version of the compiler (Download current version here, 51k when gzipped) as v1/browser-compiler/coffee-script.js. Include this file on a page with inline CoffeeScript tags, and it will compile and evaluate them in order.<script type="text/coffeescript"> tags. The source includes a compressed and minified version of the compiler (Download current version here, 51k when gzipped) as docs/v1/browser-compiler/coffee-script.js. Include this file on a page with inline CoffeeScript tags, and it will compile and evaluate them in order.CoffeeScript.compile() so you can pop open Firebug and try compiling some strings.window object.bin/coffee to test your changes,
git checkout lib && bin/cake build:full is a good command to run when you’re working on the core language. It’ll refresh the lib folder (in case you broke something), build your altered compiler, use that to rebuild itself (a good sanity test) and then run all of the tests. If they pass, there’s a good chance you’ve made a successful change.
Run CoffeeScript’s test suite in your current browser.
MINIFY=false cake build:browser.Error.prepareStackTrace has been removed.for…from syntax for outputting ES2015 for…of. (Sorry they couldn’t match, but we came up with for…of first for something else.) This allows iterating over generators or any other iterable object. Note that using for…from in your code makes you responsible for ensuring that either your runtime supports for…of or that you transpile the output JavaScript further to a version your target runtime(s) support.```) allow the creation of embedded JavaScript blocks where escaping single backticks is not required, which should improve interoperability with ES2015 template literals and with Markdown.\`.imports and exports are now ignored.result = (i for i in list) by default … it now p
0.5.2
Added a compressed version of the compiler for inclusion in web pages as
-/v1/browser-compiler/coffee-script.js. It’ll automatically run any script tags with type text/coffeescript for you. Added a --stdio option to the coffee command, for piped-in compiles.
browser-compiler/coffee-script.js. It’ll automatically run any script tags with type text/coffeescript for you. Added a --stdio option to the coffee command, for piped-in compiles.