Commit bb1db391 authored by Timmy Willison's avatar Timmy Willison

Build: Fix AMD option for custom builds

Fixes #14859
parent 5911b3e0
...@@ -55,12 +55,6 @@ module.exports = function( grunt ) { ...@@ -55,12 +55,6 @@ module.exports = function( grunt ) {
// Remove EXPOSE lines from Sizzle // Remove EXPOSE lines from Sizzle
.replace( /\/\/\s*EXPOSE[\w\W]*\/\/\s*EXPOSE/, "return 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 { } else {
// Ignore jQuery's exports (the only necessary one) // Ignore jQuery's exports (the only necessary one)
...@@ -87,6 +81,18 @@ module.exports = function( grunt ) { ...@@ -87,6 +81,18 @@ module.exports = function( grunt ) {
contents = contents contents = contents
.replace( /define\(\[[^\]]+\]\)[\W\n]+$/, "" ); .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; return contents;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment