Haml plugin for Grails, based on JHaml

  • Tags : /
  • Latest : 0.3
  • Last Updated: 26 July 2010
  • Grails version : 1.2.2 > *
  • Authors : null
0 vote
Dependency :
compile ":haml:0.3"

Documentation

Summary

Installation

First install the plugin:

grails install-plugin haml

Then add the following to your grails-app/config/spring/resources.groovy (in the beans block):

groovyPageResourceLoader(com.cadrlife.jhaml.grailsplugin.HamlGroovyPageResourceLoader) {
  baseResource = new org.springframework.core.io.FileSystemResource(".")
}

For Grails 2.0, use:

groovyPageResourceLoader(com.cadrlife.jhaml.grailsplugin.HamlGroovyPageResourceLoader) {
  baseResource = "file:."
  pluginSettings = new grails.util.PluginBuildSettings(grails.util.BuildSettingsHolder.settings)
}

You can now have ".haml" files in your views directory. They will be converted to GSPs on request (if using grails run-app) or on war creation.

Description

Grails haml support, using JHaml. Allows you to automatically generate GSPs from .haml files.

/ Haml
#profile
  .left.column
    #date= date
    #address= user.address
  .right.column
    #email= user.email
    #bio= user.bio

<!-- GSP/JSP -->
<div id="profile">
  <div class="left column">
    <div id="date"><%= date %></div>
    <div id="address"><%= user.address %></div>
  </div>
  <div class="right column">
    <div id="email"><%= user.email %></div>
    <div id="bio"><%= user.bio %></div>
  </div>
</div>

Learn more in the Haml tutorial.

Here are example translations of the default index.gsp and layout/main.gsp in newly created Grails projects.