Skip to content

Instantly share code, notes, and snippets.

@berzniz
Created June 9, 2012 13:01
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save berzniz/2900905 to your computer and use it in GitHub Desktop.
Save berzniz/2900905 to your computer and use it in GitHub Desktop.
handlebars3
Handlebars.getTemplate = function(name) {
if (Handlebars.templates === undefined || Handlebars.templates[name] === undefined) {
$.ajax({
url : 'templatesfolder/' + name + '.handlebars',
success : function(data) {
if (Handlebars.templates === undefined) {
Handlebars.templates = {};
}
Handlebars.templates[name] = Handlebars.compile(data);
},
async : false
});
}
return Handlebars.templates[name];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment