From bba9bb2f27312000fcb3ea8956b24bb876cf8f2b Mon Sep 17 00:00:00 2001 From: Ruben Nascimento Date: Mon, 11 Jan 2016 00:06:16 +0100 Subject: [PATCH] Fix travis test checks for #160 --- README.md | 14 ++++---------- tasks/handlebars.js | 28 +++++++++++++++------------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index b89bf74..ba9c2b4 100644 --- a/README.md +++ b/README.md @@ -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'] + } } ``` @@ -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` @@ -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.* diff --git a/tasks/handlebars.js b/tasks/handlebars.js index d912b00..9a7011f 100644 --- a/tasks/handlebars.js +++ b/tasks/handlebars.js @@ -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 = ''; @@ -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) { @@ -227,7 +230,6 @@ module.exports = function(grunt) { } output.push('});'); } - // End of AMD if (options.commonjs) { if (useNamespace) {