walmartlabs/lumbar — pull request #64 by beastridge (2012-07-09 18:26:44+00:00)
Title: add templateTemplate, precompiledTemplate, moduleStartTemplate, moduleEndTemplate configuration values

Instead of doing thorax plugins to add the functionality I wanted I added the ability to specify the templates used. They are only checked / compiled once and all of the unit tests pass. I wanted to support this syntax in Thorax project modules:

module.router({
callback: function(){blah}
});

And this syntax for the template registry:

Application.template('name', string);

Which will save wire size if you aren't precompiling. Here is the sample JSON from the boilerplate lumbar + thorax project:

"moduleStartTemplate": "{{{scope}}} = (function() {var module = {exports: {}}; var exports = module.exports; {{^isTopNamespace}}Thorax.addModuleMethods(module, {{{name}}});{{/isTopNamespace}}",
"moduleEndTemplate": "return module.exports;}).call(this);",
"templateTemplate": "{{{templateCache}}}('{{{name}}}', '{{{data}}}');",
"precompiledTemplate": "{{{templateCache}}}('{{{name}}}', {{{data}}});"

The default templates are unchanged.