Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (34 sloc) 1.55 KB

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'}] } ) );
Jump to Line
Something went wrong with that request. Please try again.