aboutsummaryrefslogtreecommitdiffstats
path: root/build/tasks/sourcemap.js
blob: 8b9c248e07faf2d7be06fc378b938a6a00bf3d0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"use strict";

var fs = require( "fs" );

module.exports = function( grunt ) {
	var config = grunt.config( "minify.all.files" );
	grunt.registerTask( "remove_map_comment", function() {
		var minLoc = grunt.config.process( Object.keys( config )[ 0 ] );

		// 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 );
	} );
};