Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add namespace arg to handlebars bin

Fixes #361
  • Loading branch information...
commit eaa7e97461b9e29899d32566542e8abf07e1c45a 1 parent 59e30ec
@kpdecker kpdecker authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 bin/handlebars
View
12 bin/handlebars
@@ -39,6 +39,12 @@ var optimist = require('optimist')
'description': 'Minimize output',
'alias': 'min'
},
+ 'n': {
+ 'type': 'string',
+ 'description': 'Template namespace',
+ 'alias': 'namespace',
+ 'default': 'Handlebars.templates'
+ },
's': {
'type': 'boolean',
'description': 'Output template function only.',
@@ -112,7 +118,11 @@ if (!argv.simple) {
} else {
output.push('(function() {\n');
}
- output.push(' var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};\n');
+ output.push(' var template = Handlebars.template, templates = ');
+ output.push(argv.namespace);
+ output.push(' = ');
+ output.push(argv.namespace);
+ output.push(' || {};\n');
}
function processTemplate(template, root) {
var path = template,
Please sign in to comment.
Something went wrong with that request. Please try again.