Haml plugin for Grails, based on JHaml
Dependency :
compile ":haml:0.3"
Summary
Installation
First install the plugin:Then add the following to your grails-app/config/spring/resources.groovy (in the beans block):For Grails 2.0, use: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.
grails install-plugin haml
groovyPageResourceLoader(com.cadrlife.jhaml.grailsplugin.HamlGroovyPageResourceLoader) {
baseResource = new org.springframework.core.io.FileSystemResource(".")
}groovyPageResourceLoader(com.cadrlife.jhaml.grailsplugin.HamlGroovyPageResourceLoader) {
baseResource = "file:."
pluginSettings = new grails.util.PluginBuildSettings(grails.util.BuildSettingsHolder.settings)
}Description
Grails haml support, using JHaml. Allows you to automatically generate GSPs from .haml files.Learn more in the Haml tutorial.Here are example translations of the default index.gsp and layout/main.gsp in newly created Grails projects.
/ 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>