Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Coffeescript

stefri edited this page Jan 4, 2012 · 2 revisions

To use this plugin together with the CoffeeScript Plugin you integrate the coffeescript plugin as discribed in the plugins README. As soon as you added both plugin settings to your projects configuration compile depends on both. What you have to change is to make the Ember.js Plugin also depend on the CoffeeScript coffee statement to make sure your javascript is always generated before the aggregation runs.

You can do so by including the following statement in your configuration:

import emberjs.EmberjsPlugin._
import coffeescript.Plugin.CoffeeKeys

[... configure your build ...]

// Your project configuration might look like this
lazy val yourEmberjsProject = Project("emberjs-project", file("your-project-folder"), settings =
  coffeescript.Plugin.coffeeSettings ++ emberjsSettings ++ Seq(
    (CoffeeKeys.bare in (Compile, CoffeeKeys.coffee)) := true,
    EmberjsKeys.emberjs in Compile <<= (EmberjsKeys.emberjs in Compile).dependsOn(CoffeeKeys.coffee in Compile)
  )
)

While it is not necessary to use the bare setting for the coffeescript plugin, it prevents coffeescript from wrapping each source in a anonymous function. It's wrapped by spade later on anyway, so this does not bring any benefits appart from another indirection.

Clone this wiki locally