Avoid duplicate "sourceMappingURL=" lines.

Avoid duplicate // sourceMappingURL=... lines when minifying AND
generating a map. UglifyJS2 will write the line when minifying.

(cherry picked from commit 660a117)
This commit is contained in:
Joonas Lahtinen
2017-02-13 23:10:13 +01:00
committed by Nils Knappmeier
parent 406f2ee01f
commit 01b0f656bb
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() {