Skip to content

Commit

Permalink
Realign sourcemap content files after minification
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed Sep 17, 2013
1 parent e99d2b6 commit 4dc481c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,13 @@ module.exports = function(grunt) {
grunt.registerTask('sourcemap_copy', 'Copy sourcesContent between sourcemaps', function(source, dest) {
var sourceMap = grunt.file.readJSON(source);
var destMap = grunt.file.readJSON(dest);
destMap.sourcesContent = sourceMap.sourcesContent;
destMap.sourcesContent = [];
var ssources = sourceMap.sources;
// uglify may reorder sources, make sure sourcesContent matches new order
destMap.sources.forEach(function(source) {
var j = ssources.indexOf(source);
destMap.sourcesContent.push(sourceMap.sourcesContent[j]);
});
grunt.file.write(dest, JSON.stringify(destMap));
});
grunt.registerTask('default', ['concat_sourcemap', 'uglify', 'sourcemap_copy:polymer.concat.js.map:polymer.min.js.map', 'audit']);
Expand Down

0 comments on commit 4dc481c

Please sign in to comment.