Skip to content

Commit

Permalink
Build: Fix AMD option for custom builds
Browse files Browse the repository at this point in the history
Fixes #14859
  • Loading branch information
timmywil committed Mar 7, 2014
1 parent 2df1aad commit 984f77a
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions build/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}

Expand Down

0 comments on commit 984f77a

Please sign in to comment.