Skip to content

Instantly share code, notes, and snippets.

@prabirshrestha
Created October 4, 2012 01:08
Show Gist options
  • Save prabirshrestha/3830907 to your computer and use it in GitHub Desktop.
Save prabirshrestha/3830907 to your computer and use it in GitHub Desktop.
// current implementation of JavaScriptHtmlTemplatePipeline
(function(d) {
var addTemplate = function(id, content) {
var script = d.createElement('script');
script.type = 'text/html';
script.id = id;
if (typeof script.textContent !== 'undefined') {
script.textContent = content;
} else {
script.innerText = content;
}
var x = d.getElementsByTagName('script')[0];
x.parentNode.insertBefore(script, x);
};
addTemplate("todo/index","<div id=\"todo-container\">\r\n Todo\r\n</div>");
}(document));
JST || (JST = {});
JST["todo/index"] = "<div id=\"todo-container\">\r\n Todo\r\n</div>";
// allow source to be preprocessed too
JST || (JST = {});
JST["todo/index"] = ....compiled template from server (so no need to compile it in client side)...;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment