Roy plugin for Play 2.0
JavaScript Scala
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
project Use system properties instead of environment variables Mar 3, 2012

Ray - Roy on Play 2.0


Ray is a Roy 'compiled asset plugin' for Play 2.0 - it is similar to the built-in CoffeeScript compiler. Roy files placed under app/assets/javascripts will be requestable as if they were plain JavaScript files.

For example, Roy code in app/assets/javascripts/main.roy will be automatically compiled to JavaScript when requested via public/javascripts/main.js:

Compile time errors (such as static type errors) will cause a nice Play error page:


First you must publish the plugin to your Play 2.0 repository. You will have to specify your top level play directory and the version:

sbt -Dplay.path=../play-2.0-RC3 -Dplay.version=2.0-RC3 publish

Then add the plugin to your application's project/plugins.sbt:

addSbtPlugin("org.brianmckenna" % "ray" % "0.1")

Now you can add an import to your application's project/Build.scala:

import org.brianmckenna.ray.RoyBuild

And extend your Build with the RoyBuild trait:

object ApplicationBuild extends Build with RoyBuild

Finally add the following lines to the settings call:

royEntryPoints <<= (sourceDirectory in Compile)(base => base / "assets" ** "*.roy"),

royOptions := Seq.empty[String],

resourceGenerators in Compile <+= RoyCompiler