diff --git a/docs/v1/index.html b/docs/v1/index.html index 440014b2..b6824515 100644 --- a/docs/v1/index.html +++ b/docs/v1/index.html @@ -594,18 +594,18 @@ pre .xml .cdata { Annotated Source @@ -615,10 +615,10 @@ pre .xml .cdata {

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, for…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.

-

Latest Version: 1.12.7

+

Latest 1.x Version: 1.12.7

npm install -g coffeescript
 
-

CoffeeScript 2 is coming! It adds support for ES2015 classes, async/await, JSX, object rest/spread syntax, and JavaScript generated using ES2015+ syntax. Learn more.

+

Upgrade to CoffeeScript 2! It adds support for ES2015 classes, async/await, JSX, object rest/spread syntax, and JavaScript generated using modern syntax. Learn more.

Overview

CoffeeScript on the left, compiled JavaScript output on the right.

@@ -741,7 +741,7 @@ cubes = (function() { ;alert(cubes);">run: cubes

Installation

-

The command-line version of 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).

+

The command-line version of 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).

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:

npm install --global coffeescript
 
@@ -2441,7 +2441,7 @@ task('build:parser', 'rebuild t dir = options.output || 'lib'; return fs.writeFile(dir + "/parser.js", code); }); -
load

If you need to invoke one task before another — for example, running 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.

+
load

If you need to invoke one task before another — for example, running 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

-

While it’s not recommended for serious use, CoffeeScripts may be included directly within the browser using <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.

+

While it’s not recommended for serious use, CoffeeScripts may be included directly within the browser using <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.

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 CoffeeScript.compile() so you can pop open Firebug and try compiling some strings.

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 window object.

@@ -2501,7 +2501,7 @@ Use 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.

  • -

    Browser Tests
    +

    Browser Tests
    Run CoffeeScript’s test suite in your current browser.

  • @@ -2592,7 +2592,7 @@ The CoffeeScript logo is available in SVG for use in presentations.

  • The browser compiler can once again be built unminified via MINIFY=false cake build:browser.
  • The error-prone patched version of Error.prepareStackTrace has been removed.
  • Command completion in the REPL (pressing tab to get suggestions) has been fixed for Node 6.9.1+.
  • -
  • The browser-based tests now include all the tests as the Node-based version.
  • +
  • The browser-based tests now include all the tests as the Node-based version.
  • @@ -2611,7 +2611,7 @@ The CoffeeScript logo is available in SVG for use in presentations.

  • CoffeeScript now provides a 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.
  • Triple backticks (```​) 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.
  • Within single-backtick embedded JavaScript, backticks can now be escaped via \`​.
  • -
  • The browser tests now run in the browser again, and are accessible here if you would like to test your browser.
  • +
  • The browser tests now run in the browser again, and are accessible here if you would like to test your browser.
  • CoffeeScript-only keywords in ES2015 imports and exports are now ignored.
  • The compiler now throws an error on trying to export an anonymous class.
  • Bugfixes related to tokens and location data, for better source maps and improved compatibility with downstream tools.
  • @@ -3016,7 +3016,7 @@ used to parse as 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.

    0.5.1 @@ -3222,7 +3222,7 @@ compileSource() - + diff --git a/documentation/sections/cake.md b/documentation/sections/cake.md index f2fc6b93..56bc7cee 100644 --- a/documentation/sections/cake.md +++ b/documentation/sections/cake.md @@ -8,4 +8,4 @@ Task definitions are written in CoffeeScript, so you can put arbitrary code in y codeFor('cake_tasks') ``` -If you need to invoke one task before another — for example, running `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](/v<%= majorVersion %>/annotated-source/cake.html). If you need dependencies, or async callbacks, it’s best to put them in your code itself — not the cake task. +If you need to invoke one task before another — for example, running `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](annotated-source/cake.html). If you need dependencies, or async callbacks, it’s best to put them in your code itself — not the cake task. diff --git a/documentation/sections/changelog.md b/documentation/sections/changelog.md index 5d4fe142..1397ee19 100644 --- a/documentation/sections/changelog.md +++ b/documentation/sections/changelog.md @@ -49,7 +49,7 @@ releaseHeader('2016-12-16', '1.12.2', '1.12.1') * The browser compiler can once again be built unminified via `MINIFY=false cake build:browser`. * The error-prone patched version of `Error.prepareStackTrace` has been removed. * Command completion in the REPL (pressing tab to get suggestions) has been fixed for Node 6.9.1+. -* The [browser-based tests](/v<%= majorVersion %>/test.html) now include all the tests as the Node-based version. +* The [browser-based tests](test.html) now include all the tests as the Node-based version. ``` releaseHeader('2016-12-07', '1.12.1', '1.12.0') @@ -66,7 +66,7 @@ releaseHeader('2016-12-04', '1.12.0', '1.11.1') * CoffeeScript now provides a [`for…from`](#generator-iteration) syntax for outputting ES2015 [`for…of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/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. * Triple backticks (`` ```​``) 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. * Within single-backtick embedded JavaScript, backticks can now be escaped via `` \`​``. -* The browser tests now run in the browser again, and are accessible [here](/v<%= majorVersion %>/test.html) if you would like to test your browser. +* The browser tests now run in the browser again, and are accessible [here](test.html) if you would like to test your browser. * CoffeeScript-only keywords in ES2015 `import`s and `export`s are now ignored. * The compiler now throws an error on trying to export an anonymous class. * Bugfixes related to tokens and location data, for better source maps and improved compatibility with downstream tools. @@ -437,7 +437,7 @@ releaseHeader('2010-02-25', '0.5.2', '0.5.1') ``` Added a compressed version of the compiler for inclusion in web pages as -`/v<%= majorVersion %>/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. ``` releaseHeader('2010-02-24', '0.5.1', '0.5.0') diff --git a/documentation/sections/installation.md b/documentation/sections/installation.md index 1d986b87..7f16ae17 100644 --- a/documentation/sections/installation.md +++ b/documentation/sections/installation.md @@ -1,6 +1,6 @@ ## Installation -The command-line version of `coffee` is available as a [Node.js](https://nodejs.org/) utility. The [core compiler](/v<%= majorVersion %>/browser-compiler/coffee-script.js) however, does not depend on Node, and can be run in any JavaScript environment, or in the browser (see [Try CoffeeScript](#try)). +The command-line version of `coffee` is available as a [Node.js](https://nodejs.org/) utility. The [core compiler](browser-compiler/coffee-script.js) however, does not depend on Node, and can be run in any JavaScript environment, or in the browser (see [Try CoffeeScript](#try)). To install, first make sure you have a working copy of the latest stable version of [Node.js](https://nodejs.org/). You can then install CoffeeScript globally with [npm](https://www.npmjs.com/): @@ -16,4 +16,4 @@ When you need CoffeeScript as a dependency of a project, within that project’s npm install --save coffeescript ``` -The `coffee` and `cake` commands will first look in the current folder to see if CoffeeScript is installed locally, and use that version if so. This allows different versions of CoffeeScript to be installed globally and locally. \ No newline at end of file +The `coffee` and `cake` commands will first look in the current folder to see if CoffeeScript is installed locally, and use that version if so. This allows different versions of CoffeeScript to be installed globally and locally. diff --git a/documentation/sections/introduction.md b/documentation/sections/introduction.md index 270fff38..9e04afb2 100644 --- a/documentation/sections/introduction.md +++ b/documentation/sections/introduction.md @@ -4,10 +4,10 @@ The golden rule of CoffeeScript is: _“It’s just JavaScript”_. The code com The CoffeeScript compiler goes to great lengths to generate output JavaScript that runs in every JavaScript runtime, but there are exceptions. Use [generator functions](#generator-functions), [`for…from`](#generator-iteration), or [tagged template literals](#tagged-template-literals) only if you know that your [target runtimes can support them](http://kangax.github.io/compat-table/es6/). If you use [modules](#modules), you will need to [use an additional tool to resolve them](#modules-note). -**Latest Version:** [<%= fullVersion %>](https://github.com/jashkenas/coffeescript/tarball/<%= fullVersion %>) +**Latest 1.x Version:** [<%= fullVersion %>](https://github.com/jashkenas/coffeescript/tarball/<%= fullVersion %>) ```bash npm install -g coffeescript ``` -**CoffeeScript 2 is coming!** It adds support for [ES2015 classes](/v2/#classes), [`async`/`await`](/v2/#fat-arrow), [JSX](/v2/#jsx), [object rest/spread syntax](/v2/#splats), and JavaScript generated using ES2015+ syntax. [Learn more](/v2/). +**Upgrade to CoffeeScript 2!** It adds support for [ES2015 classes](/#classes), [`async`/`await`](/#async-functions), [JSX](/#jsx), [object rest/spread syntax](/#splats), and [JavaScript generated using modern syntax](/#coffeescript-2). [Learn more](/announcing-coffeescript-2/). diff --git a/documentation/sections/resources.md b/documentation/sections/resources.md index 56221136..d7e20de5 100644 --- a/documentation/sections/resources.md +++ b/documentation/sections/resources.md @@ -7,7 +7,7 @@ `bin/cake build:except-parser` to recompile much faster if you’re not editing `grammar.coffee`. `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. -* [Browser Tests](/v<%= majorVersion %>/test.html)
    +* [Browser Tests](test.html)
    Run CoffeeScript’s test suite in your current browser. * [CoffeeScript Issues](https://github.com/jashkenas/coffeescript/issues)
    Bug reports, feature proposals, and ideas for changes to the language belong here. diff --git a/documentation/sections/scripts.md b/documentation/sections/scripts.md index 5dec8093..0115f54d 100644 --- a/documentation/sections/scripts.md +++ b/documentation/sections/scripts.md @@ -1,6 +1,6 @@ ## "text/coffeescript" Script Tags -While it’s not recommended for serious use, CoffeeScripts may be included directly within the browser using ` - +