Skip to content

Commit

Permalink
Avoid duplicate "sourceMappingURL=" lines.
Browse files Browse the repository at this point in the history
Avoid duplicate // sourceMappingURL=... lines when minifying AND
generating a map. UglifyJS2 will write the line when minifying.
  • Loading branch information
joonas-lahtinen authored and nknapp committed Feb 14, 2017
1 parent c997020 commit 660a117
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 0 additions & 3 deletions lib/precompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,6 @@ module.exports.cli = function(opts) {
outSourceMap: opts.map,
inSourceMap: JSON.parse(output.map)
});
if (opts.map) {
output.code += '\n//# sourceMappingURL=' + opts.map + '\n';
}
}

if (opts.map) {
Expand Down
4 changes: 2 additions & 2 deletions spec/precompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ describe('precompiler', function() {
Precompiler.cli({templates: [emptyTemplate], map: 'foo.js.map'});

equal(file, 'foo.js.map');
equal(/sourceMappingURL=/.test(log), true);
equal(log.match(/sourceMappingURL=/g).length, 1);
});

it('should output map', function() {
Precompiler.cli({templates: [emptyTemplate], min: true, map: 'foo.js.map'});

equal(file, 'foo.js.map');
equal(/sourceMappingURL=/.test(log), true);
equal(log.match(/sourceMappingURL=/g).length, 1);
});

describe('#loadTemplates', function() {
Expand Down

0 comments on commit 660a117

Please sign in to comment.