Compiled assets in Play 2.0 must be defined in the
public/ folder as other unmanaged assets, meaning that there is no difference in the way you use them once compiled.
Note that managed resources are not copied directly into your application’s
publicfolder, but maintained in a separate folder in
For example a CoffeeScript source file
CoffeeScript sources are compiled automatically during a
compile command, or when you refresh any page in your browser while you are running in development mode. Any compilation errors will be displayed in your browser:
Here is an example layout for using CoffeeScript in your projects:
CoffeeScript compilation can be configured in your project’s
Build.scala file (in the settings part of the
PlayProject). The only option currently supported is bare mode.
coffeescriptOptions := Seq("bare")
Note there is a new experimental option which lets you use the native coffee script compiler. The benefit is that it’s way faster, the disadvantage is that it’s an external dependency. If you want to try this, add this to your settings:
coffeescriptOptions := Seq("native", "/usr/local/bin/coffe -p")
bare option removes this function wrapper.
Next: Using LESS CSS
Found an error in this documentation? The source code for this page can be found here. After reading the documentation guidelines, please feel free to contribute a pull request. Have questions or advice to share? Go to our community forums to start a conversation with the community.