Handlebars Asset-Pipeline Plugin

  • Tags: ui, resources, handlebars, assets
  • Latest: 1.3.0.3
  • Last Updated: 18 March 2014
  • Grails version: 2.0 > *
1 vote
Dependency:
compile ":handlebars-asset-pipeline:1.3.0.3"

 Documentation  Source  Issues

Summary

Provides Handlebars precompiler support for the asset-pipeline static asset management plugin.

Installation

grails install-plugin handlebars-asset-pipeline

Description

The Grails `handlebars-asset-pipeline` is a plugin that provides handlebars template precompiler support to asset-pipeline.

For more information on how to use asset-pipeline, visit http://www.github.com/bertramdev/asset-pipeline.

Usage

Simply create files in your standard `assets/javascripts` folder with extension `.handlebars` or 'hbs'.

By default the templateRoot for your template names is specified as blank. This means that any handlebars file within the root assets/javascripts folder will utilize its file name (without the extension) as its template name. Or a file in `templates/show.handlebars` would be named `templates/show`. If templates is set as the templateRoot than it would be named `show`

It is also possible to change the template path seperator for templatenames to be used by handlebars:

grails {
	assets {
		handlebars {
			templateRoot = 'templates'
			templatePathSeperator = "/"
	  }
  }
}

Using in the Browser

Template functions are stored in the `Handlebars.templates` object using the template name. If the template name is `person/show`, then the template function can be accessed from:

Handlebars.templates['person/show']
See the Template Names section for how template names are calculated.

See the Handlebars.js website for more information on using Handlebars template functions.