Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fetchTemplate For Handlebars Templates
fetchTemplate: function(path, done) {
Handlebars.templates = Handlebars.templates || {};
// Should be an instant synchronous way of getting the template, if it
// exists in the JST object.
if (Handlebars.templates[path]) {
return done(Handlebars.templates[path]);
}
// Fetch it asynchronously if not available from JST
/*return $.get(path, function(contents) {
var tmpl = _.template(contents);
JST[path] = tmpl;
done(tmpl);
});*/
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment