Created
June 9, 2012 13:01
-
-
Save berzniz/2900905 to your computer and use it in GitHub Desktop.
handlebars3
This file contains hidden or 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
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