Avoid duplicate "sourceMappingURL=" lines.

Avoid duplicate // sourceMappingURL=... lines when minifying AND
generating a map. UglifyJS2 will write the line when minifying.
This commit is contained in:
Joonas Lahtinen
2017-02-14 00:10:13 +02:00
committed by Nils Knappmeier
parent c9970200a0
commit 660a117536
2 changed files with 2 additions and 5 deletions
-3
View File
@@ -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) {
+2 -2
View File
@@ -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() {