]> source.dussan.org Git - jquery.git/commitdiff
Build: Fix AMD option for custom builds
authorTimmy Willison <timmywillisn@gmail.com>
Fri, 7 Mar 2014 14:55:26 +0000 (09:55 -0500)
committerTimmy Willison <timmywillisn@gmail.com>
Fri, 7 Mar 2014 14:56:43 +0000 (09:56 -0500)
Fixes #14859

build/tasks/build.js

index c480f5209e1849449605979bc7e961e49627c2ba..4d5176657487915c6e35f569530eaf96918ae4bd 100644 (file)
@@ -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;
        }