Posted by Maedi on January 17, 2012 at 2:20am
Coming very soon.
CoffeeScript is a simple and elegant version of JavaScript.
This module provides CoffeeScript integration with Drupal, allowing you to write CoffeeScript code, which is automatically converted into JavaScript for use by the browser. CoffeeScript can also be used in combination with jQuery and some examples are below.
Usage
Add CoffeeScripts to your Drupal site by using one of the following:
# in your themes html.tpl.php
<?php print coffeescript_add('myscript.js.coffee') ?>
# or in your themes .info file:
scripts[] = myscript.js.coffeeInstallation
Requires the Libraries API
- Download the CoffeeScript PHP library from GitHub.
- Place the extracted folder in your sites/all/libraries folder
- Download and install this module
Why CoffeeScript?
In CoffeeScript, the function keyword is replaced by the -> symbol, and indentation is used instead of curly braces. Parentheses "{}" can be omitted.
A jQuery before and after:
$(document).ready(function() {
// Do something
});$ ->
# Do somethingDownloads
Project Information
- Maintenance status: Actively maintained
- Development status: Under active development
- Last modified: May 11, 2012