Skip to content

Instantly share code, notes, and snippets.

@joefitzgerald
Created March 7, 2012 03:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joefitzgerald/1990762 to your computer and use it in GitHub Desktop.
Save joefitzgerald/1990762 to your computer and use it in GitHub Desktop.
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