diff options
author | Timmy Willison <timmywillisn@gmail.com> | 2014-03-07 09:55:26 -0500 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2014-03-07 09:56:43 -0500 |
commit | bb1db391cd6c6fa801762d9ad6e9c8fc10311477 (patch) | |
tree | 7aff61eb0170f1cd4ef47efbb773f2573884f591 | |
parent | 5911b3e08798d23c408fab4d0fdf858650ad6b32 (diff) | |
download | jquery-bb1db391cd6c6fa801762d9ad6e9c8fc10311477.tar.gz jquery-bb1db391cd6c6fa801762d9ad6e9c8fc10311477.zip |
Build: Fix AMD option for custom builds
Fixes #14859
-rw-r--r-- | build/tasks/build.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/build/tasks/build.js b/build/tasks/build.js index c480f5209..4d5176657 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -55,12 +55,6 @@ module.exports = function( grunt ) { // Remove EXPOSE lines from Sizzle .replace( /\/\/\s*EXPOSE[\w\W]*\/\/\s*EXPOSE/, "return Sizzle;" ); - // AMD Name - } else if ( (amdName = grunt.option( "amd" )) != null && /^exports\/amd$/.test( name ) ) { - // Remove the comma for anonymous defines - contents = contents - .replace( /(\s*)"jquery"(\,\s*)/, amdName ? "$1\"" + amdName + "\"$2" : "" ); - } else { // Ignore jQuery's exports (the only necessary one) @@ -87,6 +81,18 @@ module.exports = function( grunt ) { contents = contents .replace( /define\(\[[^\]]+\]\)[\W\n]+$/, "" ); } + // AMD Name + if ( (amdName = grunt.option( "amd" )) != null && /^exports\/amd$/.test( name ) ) { + if (amdName) { + grunt.log.writeln( "Naming jQuery with AMD name: " + amdName ); + } else { + grunt.log.writeln( "AMD name now anonymous" ); + } + // Remove the comma for anonymous defines + contents = contents + .replace( /(\s*)"jquery"(\,\s*)/, amdName ? "$1\"" + amdName + "\"$2" : "" ); + + } return contents; } |