Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Wordsmithing, and being more explicit about how to enable it
Wiki Markup
{float:right|background=#eee}
{contentbylabel:title=Related Articles|showLabels=false|showSpace=false|space=@self|labels=javascript,ajax}
{float}

CoffeeScript (http://coffeescript.org) is a language that to compiles down to JavaScript.

Tapestry can automatically compile your CoffeeScript code into JavaScript on the fly. This is done with the optional tapestry-webresources module. It is recommended for anyone who wants to use CoffeeScript in their application ... just let Tapestry do the compilation at runtime (with access to Tapestry's full exception reporting capabilities).

To use the tapestry-webresources module, just add the JAR to your project. For example, if you're using Maven:

Code Block
languagexml
titlepom.xml (partial)
<dependency>
    <groupId>org.apache.tapestry</groupId>
    <artifactId>tapestry-webresources</artifactId>
    <version>${tapestry-release-version}</version>
</dependency>

All of Tapestry's own client-side code in written in CoffeeScript and compiled, at build-time, to JavaScript.

Note

You are completely free to use either JavaScript or CoffeeScript in your Tapestry application.

CoffeeScript versus JavaScript

CoffeeScript can be quite controversial, but also quite effective.

...

CoffeeScript code often approaches Python's goal of being a "executable psuedo-code"; code that looks like a placeholder that will actually run. Some people find it more pleasant to read than JavaScript ... more essence and less ceremony.

You can still write bad code in CoffeeScript. You can write bad code in any language.

All of Tapestry's client-side code in written in CoffeeScript and compiled, at build-time, to JavaScript.

The tapestry-web-resources module adds the ability to dynamically compile CoffeeScript to JavaScript in the running application, It is recommended for anyone who wants to use CoffeeScript in their application ... just do the compilation at runtime (with access to Tapestry's full exception reporting capabilities).