Skip to content
A grails plugin. To be used with the grails-resources plugin, it allows for eco templates to be defined as a resource just like css, or javascript.
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

This is a Grails plugin than enables the easy inclusion of eco templates into a Grails appplication. It requires the well established resources plugin.


Eco is yet another Javascript templating tool. Eco is written by PrototypeJs author Sam Stephenson.

It uses Mozilla's Rhino engine to execute the original eco compiler written in javascript.


To add eco template files to your grails project:

  • Install the plugin (adding to your BuildConfig is best)
  • Actually add the eco tempalte files to your project. I placed mine adjacent to the js folder in eco.
  • Reference your eco files in your ApplicationResources file (or where ever your defining your resources)


  eco {
    resource url: 'eco/'
    resource url: 'eco/'
    resource url: 'eco/'

The above example will create a resource you can include in pages or have another resource depend on. The templates are converted into javascript objects in the Global name space. The naming of these js objects follows the pattern "eco.$fileName" where the filename does not include the extension.

Example eco tempate

    <% for person in @people: %>
      <li> <%= %></li>      
    <% end %>

which could be referenced in your javascript code like this:

  $("li").html( eco.people( { people: [{ name: 'John' }, { name: 'Mary'}] } ) );
Something went wrong with that request. Please try again.