gruntjs / grunt-contrib-handlebars

Precompile Handlebars templates to JST file.
http://gruntjs.com/
MIT License
282 stars 126 forks source link

Return partial template when using AMD #76

Open baluubas opened 11 years ago

baluubas commented 11 years ago

I'd love to see the possibility of returning a partial template when wrapping with AMD.

For example something like this:

partials.push('var partialTemplate = ' + compiled + ';');
   if (options.partialsUseNamespace === true) {
      partials.push('Handlebars.registerPartial('+JSON.stringify(filename)+', '+nsInfo.namespace+'['+JSON.stringify(filename)+'] = partialTemplate);');
} else {
   partials.push('Handlebars.registerPartial('+JSON.stringify(filename)+', partialTemplate);');
}
if(options.amd && options.namespace === false) {
   partials.push('return partialTemplate;');
}