h1. Faster Groovy Templates module

This is a module for Play! Framework 1 applications which replaces the default groovy template implementation with "GT-Engine":https://github.com/mbknor/gt-engine which is "faster and uses less memory":http://kjetland.com/blog/2011/11/playframework-new-faster-groovy-template-engine/.

GT-Engine is also used in the "Play 2.0 module":https://github.com/mbknor/gt-engine-play2 that enables legacy support for groovy templates.

h3. History

* Version 1.6 - 8. April 2012
** Fixes issue #18 - Listing enums with #{list} now works
* Version 1.5 - 19. mar 2012
** Fixes issue #17 - No more name-clash-problem with static methods and JavaExtensions
* Version 1.4 - 4. mar 2012
** Fixed issue #13 - More intelligent when finding end-of-tag '}'
** Fixed issue #14 - GroovyTemplate.ExecutableTemplate.getProperty
* Version 1.3 - 27. feb 2012
** Improved error reporting
* Version 1.2 - 19. feb 2012
** Fixed issue related to calling method on java object with name-collision with JavaExtension-name
* Version 1.1 - 14. feb 2012
** Fixed various bugs related to #{set/} and #{get/}
* Version 1.0 - 12. feb 2012


h2. Features

* Almost 100% compatible with old Play Groovy template implementation (See note below for more info)
* Run faster
* Compiles faster
* Can write generated source to disk so you can step-debug it
* Uses less memory
* Supports old FastTag
* Supports new GTFastTag which is optimized for inserting rendered tag-body-content (without copying)


h2. 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:

<pre>
%{ if( expression) { }%
</pre>

or

<pre>
%{ myList.foreach() { }%
</pre>

Instead you have to use:

<pre>
#{if expression}
</pre>

or

<pre>
#{list myList}
</pre>


h2. 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.

h2. Getting started

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

h2. Usage

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

h3. Downloading it automatically

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

Edit your "dependencies.yml" like this:

<pre>
require:
    - play
    - play -> fastergt 1.6
</pre>

Remember to call "play dependencies" before "play run" the first time.

h3. 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.

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

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

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

<pre>
module.faster-groovy-templates=../relativePathToWhereYouDownloadedIt/
</pre>

h2. 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":

<pre>
save-gttemplate-source-to-disk = template-src	
</pre>

h2. Project page

This module is hosted on "github":https://github.com/mbknor/faster-groovy-templates

Issues should be posted "here":https://github.com/mbknor/faster-groovy-templates/issues