aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2015-01-30 12:22:25 -0800
committerTimmy Willison <timmywillisn@gmail.com>2015-01-30 12:42:21 -0800
commitf71d7f56e96480d2115bff5542ded04ce6546ec9 (patch)
tree3439e0d2f22912434e31efacd2f08a5d7e763a17 /build
parent7352216ca83e0233d2a5ec2fc4ed6583e7bfdbf1 (diff)
downloadjquery-f71d7f56e96480d2115bff5542ded04ce6546ec9.tar.gz
jquery-f71d7f56e96480d2115bff5542ded04ce6546ec9.zip
Release: remove sourcemap comment from all copies of minified file
Fixes gh-1707
Diffstat (limited to 'build')
-rw-r--r--build/release/cdn.js6
-rw-r--r--build/tasks/sourcemap.js13
2 files changed, 13 insertions, 6 deletions
diff --git a/build/release/cdn.js b/build/release/cdn.js
index 215241f40..5a45a629d 100644
--- a/build/release/cdn.js
+++ b/build/release/cdn.js
@@ -48,12 +48,6 @@ function makeReleaseCopies( Release ) {
"\"file\":\"" + unpathedFile.replace( /\.min\.map/, ".min.js" ) +
"\",\"sources\":[\"" + unpathedFile.replace( /\.min\.map/, ".js" ) + "\"]" );
fs.writeFileSync( releaseFile, text );
- } else if ( /\.min\.js$/.test( releaseFile ) ) {
- // Remove the source map comment; it causes way too many problems.
- // Keep the map file in case DevTools allow manual association.
- text = fs.readFileSync( builtFile, "utf8" )
- .replace( /\/\/# sourceMappingURL=\S+/, "" );
- fs.writeFileSync( releaseFile, text );
} else if ( builtFile !== releaseFile ) {
shell.cp( "-f", builtFile, releaseFile );
}
diff --git a/build/tasks/sourcemap.js b/build/tasks/sourcemap.js
new file mode 100644
index 000000000..5f4d5232f
--- /dev/null
+++ b/build/tasks/sourcemap.js
@@ -0,0 +1,13 @@
+var fs = require( "fs" );
+
+module.exports = function( grunt ) {
+ var minLoc = Object.keys( grunt.config( "uglify.all.files" ) )[ 0 ];
+ grunt.registerTask( "remove_map_comment", function() {
+ // Remove the source map comment; it causes way too many problems.
+ // The map file is still generated for manual associations
+ // https://github.com/jquery/jquery/issues/1707
+ var text = fs.readFileSync( minLoc, "utf8" )
+ .replace( /\/\/# sourceMappingURL=\S+/, "" );
+ fs.writeFileSync( minLoc, text );
+ });
+};