Sign in to edit and +1 items.
Login required
Download

Haml plugin for Grails, based on JHaml

(0)
Author(s) Ray Myers
Current Release 0.3   (1 year ago)
Grails Version 1.2.2 > *
Tags
Dependency
compile ":haml:0.3"
Last updated by bjaress 9 months ago
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.

Last updated by raymyers 2 years ago
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.

Last updated by admin 2 years ago
Last updated by admin 2 years ago