Skip to content

Commit

Permalink
Fix travis test checks for #160
Browse files Browse the repository at this point in the history
  • Loading branch information
bzin committed Jan 10, 2016
1 parent d9e2aa9 commit bba9bb2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ options: {
var names = filename.replace(/modules\/(.*)(\/\w+\.hbs)/, '$1');
return names.split('/').join('.');
},
},
files: {
'ns_nested_tmpls.js' : [ 'modules/**/*.hbs']
files: {
'ns_nested_tmpls.js' : [ 'modules/**/*.hbs']
}
}
```

Expand Down Expand Up @@ -102,12 +102,6 @@ define(['handlebars'], function(Handlebars) {
});
```

#### amdDefinitionName
Type: `String`
Default: `false`

This option gives a name to the AMD module. It is necessary to have amd true.

#### commonjs
Type: `Boolean`
Default: `false`
Expand Down Expand Up @@ -293,4 +287,4 @@ handlebars: {

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

*This file was generated on Fri Oct 16 2015 18:59:59.*
*This file was generated on Mon Jan 11 2016 00:04:35.*
28 changes: 15 additions & 13 deletions tasks/handlebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,24 +187,27 @@ module.exports = function(grunt) {
}

// Start to wrap file with AMD
if (options.amd) {
// addd AMD name string from options.amdDefinitionName
var amdNameString = "";
if (options.amd) {

// add AMD name string from options.amdDefinitionName
var amdNameString = '';

// Verify if it was set a name to define method and its a string
if(options.amdDefinitionName && typeof options.amdDefinitionName === 'string'){
amdNameString = '\''+options.amdDefinitionName+'\',';
}else{
amdNameString = '';
}
if (options.amdDefinitionName && typeof options.amdDefinitionName === 'string') {
amdNameString = '\'' + options.amdDefinitionName + '\',';
} else {
amdNameString = '';
}

// Wrap the file in an AMD define fn.
if (typeof options.amd === 'boolean') {
output.unshift('define('+amdNameString+'[\'handlebars\'], function(Handlebars) {');
output.unshift('define(' + amdNameString + '[\'handlebars\'], function(Handlebars) {');
} else if (typeof options.amd === 'string') {
output.unshift('define('+amdNameString+'[\'' + options.amd + '\'], function(Handlebars) {');
output.unshift('define(' + amdNameString + '[\'' + options.amd + '\'], function(Handlebars) {');
} else if (typeof options.amd === 'function') {
output.unshift('define('+amdNameString+'[\'' + options.amd(filename, ast, compiled) + '\'], function(Handlebars) {');
//jscs:disable maximumLineLength
output.unshift('define(' + amdNameString + '[\'' + options.amd(filename, ast, compiled) + '\'], function(Handlebars) {');
//jscs:enable maximumLineLength
} else if (Array.isArray(options.amd)) {
// convert options.amd to a string of dependencies for require([...])
var amdString = '';
Expand All @@ -217,7 +220,7 @@ module.exports = function(grunt) {
}

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

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

if (options.commonjs) {
if (useNamespace) {
Expand Down

0 comments on commit bba9bb2

Please sign in to comment.