Skip to content

Commit a76c781

Browse files
committedJan 30, 2015
Release: remove sourcemap comment from all copies of minified file
Fixes gh-1707
1 parent e0673df commit a76c781

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed
 

Diff for: ‎Gruntfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ module.exports = function( grunt ) {
161161
grunt.registerTask( "test", [ "test_fast" ] );
162162

163163
// Short list as a high frequency watch task
164-
grunt.registerTask( "dev", [ "build:*:*", "lint", "uglify", "dist:*" ] );
164+
grunt.registerTask( "dev", [ "build:*:*", "lint", "uglify", "remove_map_comment", "dist:*" ] );
165165

166166
grunt.registerTask( "default", [ "dev", "test_fast", "compare_size" ] );
167167
};

Diff for: ‎build/release/cdn.js

-6
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ function makeReleaseCopies( Release ) {
4444
"\"file\":\"" + unpathedFile.replace( /\.min\.map/, ".min.js" ) +
4545
"\",\"sources\":[\"" + unpathedFile.replace( /\.min\.map/, ".js" ) + "\"]" );
4646
fs.writeFileSync( releaseFile, text );
47-
} else if ( /\.min\.js$/.test( releaseFile ) ) {
48-
// Remove the source map comment; it causes way too many problems.
49-
// Keep the map file in case DevTools allow manual association.
50-
text = fs.readFileSync( builtFile, "utf8" )
51-
.replace( /\/\/# sourceMappingURL=\S+/, "" );
52-
fs.writeFileSync( releaseFile, text );
5347
} else if ( builtFile !== releaseFile ) {
5448
shell.cp( "-f", builtFile, releaseFile );
5549
}

Diff for: ‎build/tasks/sourcemap.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var fs = require( "fs" );
2+
3+
module.exports = function( grunt ) {
4+
var minLoc = Object.keys( grunt.config( "uglify.all.files" ) )[ 0 ];
5+
grunt.registerTask( "remove_map_comment", function() {
6+
// Remove the source map comment; it causes way too many problems.
7+
// The map file is still generated for manual associations
8+
// https://github.com/jquery/jquery/issues/1707
9+
var text = fs.readFileSync( minLoc, "utf8" )
10+
.replace( /\/\/# sourceMappingURL=\S+/, "" );
11+
fs.writeFileSync( minLoc, text );
12+
});
13+
};

Diff for: ‎package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"grunt-cli": "0.1.13",
3636
"grunt-compare-size": "0.4.0",
3737
"grunt-contrib-jshint": "0.10.0",
38-
"grunt-contrib-uglify": "0.6.0",
38+
"grunt-contrib-uglify": "0.7.0",
3939
"grunt-contrib-watch": "0.6.1",
4040
"grunt-git-authors": "2.0.1",
4141
"grunt-jscs-checker": "0.8.1",
@@ -61,7 +61,6 @@
6161
"Tests",
6262
"Build",
6363
"Release",
64-
6564
"Core",
6665
"Ajax",
6766
"Attributes",

0 commit comments

Comments
 (0)