mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
No ticket. Simplify the post-uglify task.
This commit is contained in:
parent
2c0b9027de
commit
923bfc80db
@ -123,12 +123,9 @@ module.exports = function( grunt ) {
|
|||||||
},
|
},
|
||||||
"post-uglify": {
|
"post-uglify": {
|
||||||
all: {
|
all: {
|
||||||
files: {
|
src: [ "dist/jquery.min.map" ],
|
||||||
"dist/jquery.min.map.tmp": [ "dist/jquery.min.map" ],
|
|
||||||
"dist/jquery.min.js.tmp": [ "dist/jquery.min.js" ]
|
|
||||||
},
|
|
||||||
options: {
|
options: {
|
||||||
tempFiles: [ "dist/jquery.min.map.tmp", "dist/jquery.min.js.tmp", "dist/jquery.pre-min.js" ]
|
tempFiles: [ "dist/jquery.pre-min.js" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,10 @@ module.exports = function( grunt ) {
|
|||||||
// Remove the main jQuery banner, it'll be replaced by the new banner anyway.
|
// Remove the main jQuery banner, it'll be replaced by the new banner anyway.
|
||||||
.replace( /^\/\*![\W\w]*?\*\/\n?/g, "" )
|
.replace( /^\/\*![\W\w]*?\*\/\n?/g, "" )
|
||||||
// Strip other banners preserving line count.
|
// Strip other banners preserving line count.
|
||||||
.replace( /^\/\*!(?:.|\n)*?\*\/\n?/gm, function ( match ) {
|
.replace( /^\/\*!(?:.|\n)*?\*\/\n?/gm, function( match ) {
|
||||||
return match.replace( /[^\n]/gm, "" );
|
return match.replace( /[^\n]/gm, "" );
|
||||||
});
|
});
|
||||||
}).join("\n");
|
}).join( "\n" );
|
||||||
|
|
||||||
// Write temp file (with optional banner)
|
// Write temp file (with optional banner)
|
||||||
grunt.file.write( mapping.dest, ( banner || "" ) + input );
|
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.
|
// 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.
|
// The problem is caused by the pre-uglify task.
|
||||||
// Also, remove temporary files.
|
|
||||||
grunt.registerMultiTask( "post-uglify", function() {
|
grunt.registerMultiTask( "post-uglify", function() {
|
||||||
this.files.forEach(function( mapping ) {
|
this.files.forEach(function( mapping ) {
|
||||||
var mapFileName = mapping.src[ 0 ];
|
mapping.src.forEach( function( src ) {
|
||||||
|
|
||||||
// Rename the file to a temporary name.
|
|
||||||
fs.renameSync( mapFileName, mapping.dest);
|
|
||||||
grunt.file.write( mapFileName, grunt.file.read( mapping.dest )
|
|
||||||
// Refer to the source jquery.js, not the temporary jquery.pre-min.js.
|
// 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.
|
// Remove temporary files.
|
||||||
|
Loading…
Reference in New Issue
Block a user