Community contributed extensions

Less module

This module allows you to use LESS stylesheets in your Play application, without having to manually compile them to CSS. It is inspired by the sass plugin that does a similar thing for sass.

Usage

Add the less module to your application.conf:

module.less=${play.path}/modules/less

Now any file in your public/ directory that ends in .less is automatically processed by the plugin, and outputted as CSS.

Example

Create a file called public/stylesheets/style.less, with contents:

@color: red;
h1 {
  color: @color;
}

Now, add the stylesheet to your main template in app/views/main.html:

<link type="text/css" rel="stylesheet" href="@{'public/stylesheets/style.less'}" />

Notes

Currently, there is no server-side caching in the plugin. In production mode, the plugin sets the cache-control header to the value specified by http.cacheControl in your application.conf

In case of an error in your less file, the error will be shown on your page to help you debug.