Created
June 29, 2011 12:15
-
-
Save dagda1/1053720 to your computer and use it in GitHub Desktop.
loadtemplates.js
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
loadTemplates: function() { | |
var templates = {}; | |
$('*[type="text/x-js-template"]').map(function() { | |
var name = $(this).attr('name'); | |
var source = $(this).html().replace('>', '>'); | |
if(name.split('/')[1][0] == '_') { Handlebars.registerPartial(name.replace('/', ''), source) } | |
templates[name] = Handlebars.compile(source); | |
}); | |
return templates; | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment