Created
November 19, 2013 04:10
-
-
Save rom3r4/7540201 to your computer and use it in GitHub Desktop.
Using handlebars templates with marionette
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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