Created
March 7, 2012 03:36
-
-
Save joefitzgerald/1990762 to your computer and use it in GitHub Desktop.
fetchTemplate For Handlebars Templates
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
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