Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tasks/handlebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ module.exports = function(grunt) {
// nsdeclare options when fetching namespace info
var nsDeclareOptions = {response: 'details', declared: nsDeclarations};

// if 'disableGlobal' option is true prevent the templates to be declared in the global namespace
if (options.disableGlobal) {
nsDeclareOptions.root = 'templates';
}

// Just get the namespace info for a given template
var getNamespaceInfo = _.memoize(function(filepath) {
if (!useNamespace) {
Expand Down Expand Up @@ -182,7 +187,11 @@ module.exports = function(grunt) {

output.push(nodeExport);
}
}

// if the 'disableGlobal' option is true create a local root variable to contain the templates
if (options.disableGlobal) {
output.unshift('var ' + nsDeclareOptions.root + ' = {};');
}

if (options.amd) {
Expand Down