aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorMichał Gołębiowski <m.goleb@gmail.com>2013-10-02 00:39:49 +0200
committerMichał Gołębiowski <m.goleb@gmail.com>2013-10-02 00:39:49 +0200
commit923bfc80dbba00659a2fbadafad6d894973cc560 (patch)
tree1475a5f066d2e801dfd3991219f8974e0685a96f /build
parent2c0b9027de841a437baf7b9c85262f196b9cb09e (diff)
downloadjquery-923bfc80dbba00659a2fbadafad6d894973cc560.tar.gz
jquery-923bfc80dbba00659a2fbadafad6d894973cc560.zip
No ticket. Simplify the post-uglify task.
Diffstat (limited to 'build')
-rw-r--r--build/tasks/uglify.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/build/tasks/uglify.js b/build/tasks/uglify.js
index ccbc70888..f8df5e77e 100644
--- a/build/tasks/uglify.js
+++ b/build/tasks/uglify.js
@@ -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.