]> source.dussan.org Git - jquery.git/commitdiff
No ticket. Simplify the post-uglify task.
authorMichał Gołębiowski <m.goleb@gmail.com>
Tue, 1 Oct 2013 22:39:49 +0000 (00:39 +0200)
committerMichał Gołębiowski <m.goleb@gmail.com>
Tue, 1 Oct 2013 22:39:49 +0000 (00:39 +0200)
Gruntfile.js
build/tasks/uglify.js

index bbbdd40055a72ce82da3d55146c9ce8d8a209a65..6bc16a9828bf6bc70e059d879a54098e720ab434 100644 (file)
@@ -123,12 +123,9 @@ module.exports = function( grunt ) {
                },
                "post-uglify": {
                        all: {
-                               files: {
-                                       "dist/jquery.min.map.tmp": [ "dist/jquery.min.map" ],
-                                       "dist/jquery.min.js.tmp": [ "dist/jquery.min.js" ]
-                               },
+                               src: [ "dist/jquery.min.map" ],
                                options: {
-                                       tempFiles: [ "dist/jquery.min.map.tmp", "dist/jquery.min.js.tmp", "dist/jquery.pre-min.js" ]
+                                       tempFiles: [ "dist/jquery.pre-min.js" ]
                                }
                        }
                }
index ccbc708884bad45f7566278ae1ad8724903987c5..f8df5e77ed1b2f3b53cf93992fb966be46dbda2c 100644 (file)
@@ -18,10 +18,10 @@ module.exports = function( grunt ) {
                                        // Remove the main jQuery banner, it'll be replaced by the new banner anyway.
                                        .replace( /^\/\*![\W\w]*?\*\/\n?/g, "" )
                                        // Strip other banners preserving line count.
-                                       .replace( /^\/\*!(?:.|\n)*?\*\/\n?/gm, function ( match ) {
+                                       .replace( /^\/\*!(?:.|\n)*?\*\/\n?/gm, function( match ) {
                                                return match.replace( /[^\n]/gm, "" );
                                        });
-                       }).join("\n");
+                       }).join( "\n" );
 
                        // Write temp file (with optional banner)
                        grunt.file.write( mapping.dest, ( banner || "" ) + input );
@@ -30,16 +30,12 @@ module.exports = function( grunt ) {
 
        // Change the map file to point back to jquery.js instead of jquery.pre-min.js.
        // The problem is caused by the pre-uglify task.
-       // Also, remove temporary files.
        grunt.registerMultiTask( "post-uglify", function() {
                this.files.forEach(function( mapping ) {
-                       var mapFileName = mapping.src[ 0 ];
-
-                       // Rename the file to a temporary name.
-                       fs.renameSync( mapFileName, mapping.dest);
-                       grunt.file.write( mapFileName, grunt.file.read( mapping.dest )
+                       mapping.src.forEach( function( src ) {
                                // Refer to the source jquery.js, not the temporary jquery.pre-min.js.
-                               .replace( /\.pre-min\./g, "." ));
+                               grunt.file.write( src, grunt.file.read( src ).replace( /\.pre-min\./g, "." ) );
+                       });
                });
 
                // Remove temporary files.