Skip to content

Commit 42d31db

Browse files
committed
Fix travis test checks for gruntjs#160
1 parent d9e2aa9 commit 42d31db

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

README.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ options: {
5757
var names = filename.replace(/modules\/(.*)(\/\w+\.hbs)/, '$1');
5858
return names.split('/').join('.');
5959
},
60-
},
61-
files: {
62-
'ns_nested_tmpls.js' : [ 'modules/**/*.hbs']
60+
files: {
61+
'ns_nested_tmpls.js' : [ 'modules/**/*.hbs']
62+
}
6363
}
6464
```
6565

@@ -101,7 +101,6 @@ define(['handlebars'], function(Handlebars) {
101101
return this['[template namespace]'];
102102
});
103103
```
104-
105104
#### amdDefinitionName
106105
Type: `String`
107106
Default: `false`
@@ -293,4 +292,4 @@ handlebars: {
293292

294293
Task submitted by [Tim Branyen](http://tbranyen.com)
295294

296-
*This file was generated on Fri Oct 16 2015 18:59:59.*
295+
*This file was generated on Mon Jan 11 2016 01:11:22.*

docs/handlebars-options.md

+5
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

+15-13
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)