Skip to content

Commit df821e2

Browse files
committed
Fix travis test checks for #160
1 parent 4ad9863 commit df821e2

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ options: {
5656
var names = filename.replace(/modules\/(.*)(\/\w+\.hbs)/, '$1');
5757
return names.split('/').join('.');
5858
},
59-
},
60-
files: {
61-
'ns_nested_tmpls.js' : [ 'modules/**/*.hbs']
59+
files: {
60+
'ns_nested_tmpls.js' : [ 'modules/**/*.hbs']
61+
}
6262
}
6363
```
6464

@@ -100,7 +100,6 @@ define(['handlebars'], function(Handlebars) {
100100
return this['[template namespace]'];
101101
});
102102
```
103-
104103
#### amdDefinitionName
105104
Type: `String`
106105
Default: `false`

docs/handlebars-options.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ define(['handlebars'], function(Handlebars) {
7272
return this['[template namespace]'];
7373
});
7474
```
75+
## amdDefinitionName
76+
Type: `String`
77+
Default: `false`
78+
79+
This option gives a name to the AMD module. It is necessary to have amd true.
7580

7681
## commonjs
7782
Type: `Boolean`

tasks/handlebars.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,24 +187,27 @@ module.exports = function(grunt) {
187187
}
188188

189189
// Start to wrap file with AMD
190-
if (options.amd) {
191-
// addd AMD name string from options.amdDefinitionName
192-
var amdNameString = "";
190+
if (options.amd) {
191+
192+
// add AMD name string from options.amdDefinitionName
193+
var amdNameString = '';
193194

194195
// Verify if it was set a name to define method and its a string
195-
if(options.amdDefinitionName && typeof options.amdDefinitionName === 'string'){
196-
amdNameString = '\''+options.amdDefinitionName+'\',';
197-
}else{
198-
amdNameString = '';
199-
}
196+
if (options.amdDefinitionName && typeof options.amdDefinitionName === 'string') {
197+
amdNameString = '\'' + options.amdDefinitionName + '\',';
198+
} else {
199+
amdNameString = '';
200+
}
200201

201202
// Wrap the file in an AMD define fn.
202203
if (typeof options.amd === 'boolean') {
203-
output.unshift('define('+amdNameString+'[\'handlebars\'], function(Handlebars) {');
204+
output.unshift('define(' + amdNameString + '[\'handlebars\'], function(Handlebars) {');
204205
} else if (typeof options.amd === 'string') {
205-
output.unshift('define('+amdNameString+'[\'' + options.amd + '\'], function(Handlebars) {');
206+
output.unshift('define(' + amdNameString + '[\'' + options.amd + '\'], function(Handlebars) {');
206207
} else if (typeof options.amd === 'function') {
207-
output.unshift('define('+amdNameString+'[\'' + options.amd(filename, ast, compiled) + '\'], function(Handlebars) {');
208+
//jscs:disable maximumLineLength
209+
output.unshift('define(' + amdNameString + '[\'' + options.amd(filename, ast, compiled) + '\'], function(Handlebars) {');
210+
//jscs:enable maximumLineLength
208211
} else if (Array.isArray(options.amd)) {
209212
// convert options.amd to a string of dependencies for require([...])
210213
var amdString = '';
@@ -217,7 +220,7 @@ module.exports = function(grunt) {
217220
}
218221

219222
// Wrap the file in an AMD define fn.
220-
output.unshift('define('+amdNameString+'[' + amdString + '], function(Handlebars) {');
223+
output.unshift('define(' + amdNameString + '[' + amdString + '], function(Handlebars) {');
221224
}
222225

223226
if (useNamespace) {
@@ -227,7 +230,6 @@ module.exports = function(grunt) {
227230
}
228231
output.push('});');
229232
}
230-
// End of AMD
231233

232234
if (options.commonjs) {
233235
if (useNamespace) {

0 commit comments

Comments
 (0)