Permalink
Browse files

Merge pull request #488 from tnwinc/amd-module-return-values

Amd module return values
  • Loading branch information...
2 parents 075fdb8 + ca576c2 commit 4c35f89c2a9a4bb3a645ee59262a9fb1d85d338c @kpdecker kpdecker committed Apr 8, 2013
Showing with 9 additions and 0 deletions.
  1. +9 −0 bin/handlebars
View
@@ -168,8 +168,10 @@ function processTemplate(template, root) {
if (argv.simple) {
output.push(handlebars.precompile(data, options) + '\n');
} else if (argv.partial) {
+ if(argv.amd && argv._.length == 1){ output.push('return '); }
output.push('Handlebars.partials[\'' + template + '\'] = template(' + handlebars.precompile(data, options) + ');\n');
} else {
+ if(argv.amd && argv._.length == 1){ output.push('return '); }
output.push('templates[\'' + template + '\'] = template(' + handlebars.precompile(data, options) + ');\n');
}
}
@@ -182,6 +184,13 @@ argv._.forEach(function(template) {
// Output the content
if (!argv.simple) {
if (argv.amd) {
+ if(argv._.length > 1){
+ if(argv.partial){
+ output.push('return Handlebars.partials;\n');
+ } else {
+ output.push('return templates;\n');
+ }
+ }
output.push('});');
} else if (!argv.commonjs) {
output.push('})();');

0 comments on commit 4c35f89

Please sign in to comment.