diff options
author | Timmy Willison <timmywillisn@gmail.com> | 2013-12-19 15:31:36 -0500 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2013-12-19 15:31:36 -0500 |
commit | 7e8a91c205723f11cd00c8834f348a649ab15926 (patch) | |
tree | 0ee62a134fbcc6bfbbae430c9f281658de925391 /build | |
parent | a6f474e699f95a90f95228bd525490151acc0451 (diff) | |
download | jquery-7e8a91c205723f11cd00c8834f348a649ab15926.tar.gz jquery-7e8a91c205723f11cd00c8834f348a649ab15926.zip |
Build: add build option for setting the AMD name.
Fixes #14016.
Diffstat (limited to 'build')
-rw-r--r-- | build/tasks/build.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/build/tasks/build.js b/build/tasks/build.js index d4cdd1233..e5794fe93 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -42,6 +42,7 @@ module.exports = function( grunt ) { * @param {String} contents The contents to be written (including their AMD wrappers) */ function convert( name, path, contents ) { + var amdName; // Convert var modules if ( /.\/var\//.test( path ) ) { contents = contents @@ -54,6 +55,12 @@ 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) @@ -258,11 +265,11 @@ module.exports = function( grunt ) { // // grunt build:*:*:+ajax:-dimensions:-effects:-offset grunt.registerTask( "custom", function() { - var args = [].slice.call( arguments ), + var args = this.args, modules = args.length ? args[ 0 ].replace( /,/g, ":" ) : ""; grunt.log.writeln( "Creating custom build...\n" ); - grunt.task.run([ "build:*:*:" + modules, "uglify", "dist" ]); + grunt.task.run([ "build:*:*" + (modules ? ":" + modules : ""), "uglify", "dist" ]); }); }; |