Community contributed extensions

Faster Groovy Templates module

This is a module for Play! Framework 1 applications which replaces the default groovy template implementation with GT-Engine which is faster and uses less memory.

GT-Engine is also used in the Play 2.0 module that enables legacy support for groovy templates.

History

Features

Usage

Do I have to modify my templates?

If you use program-flow-fragments inside groovy code snipits you have to modify it like this:

You can no longer use partial-program-flow-code like this:


{ if( expression) { }

or


{ myList.foreach() { }

Instead you have to use:


#{if expression}

or


#{list myList}

Sample application

Since this module just replaces the default template engine, there is not much new to show in a sample application. But you can find a simple sample application in the samples-folder.

Getting started

All this sample application is doing, is to add dependency to the “Faster Groovy Templates” module.

Usage

All you have to do when using this module is to enable it.

Downloading it automatically

You can use Plays dependency mechanism to automatically download and use this plugin like this:

Edit your “dependencies.yml” like this:


require:
- play
- play -> fastergt 1.7

Remember to call “play dependencies” before “play run” the first time.

Downloading it manually

Download it from github (or git clone it), then add dependency to it like this:

One way of including the module is by using the dependencies.yml file. Remember to call “play dependencies” before “play run” the first time.


require:
- play
- faster-groovy-templates -> faster-groovy-templates

repositories:
- My modules:
type: local
artifact: ${application.path}/relativePathToWhereYouDownloadedIt/[module]
contains:
- faster-groovy-templates

Or you can add it do the application.conf file like this:


module.faster-groovy-templates=../relativePathToWhereYouDownloadedIt/

Configuration

The following configuration-setting enables “Faster Groovy Templates” to write the generated java and groovy source code to disk. This makes it possible to step-debug the template-code.

Add the following to “application.conf”:


save-gttemplate-source-to-disk = template-src

Project page

This module is hosted on github

Issues should be posted here