Skip to content

Instantly share code, notes, and snippets.

@rom3r4
Created November 19, 2013 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rom3r4/7540201 to your computer and use it in GitHub Desktop.
Save rom3r4/7540201 to your computer and use it in GitHub Desktop.
Using handlebars templates with marionette
The easiest way to use Handlebars with Marionette, including support for AMD / RequireJS, is with the Marionette.Handlebars add-on from @AsciiDisco.
Note that this plugin is not yet compatible with Marionette > 0.9.x.
Alternatively, you can use the following code in your main application or main.js file:
Backbone.Marionette.TemplateCache.prototype.compileTemplate = function(rawTemplate) {
return Handlebars.compile(rawTemplate);
};
Enhanced Handlebars integration with Marionette https://gist.github.com/funkjedi/5732611
First attempts to load pre-compiled templates, then by selector, and finally via XHR. To customize the file extension and location of your templates when loading via XHR just override Marionette.Handlebars.path and/or Marionette.Handlebars.extension.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment