Source

ray /

Filename Size Date modified Message
project
src
1.5 KB
263 B

Ray - Roy on Play 2.0

About

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:

Installation

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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.