Skip to content

Commit 660a117

Browse files
joonas-lahtinennknapp
authored andcommitted
Avoid duplicate "sourceMappingURL=" lines.
Avoid duplicate // sourceMappingURL=... lines when minifying AND generating a map. UglifyJS2 will write the line when minifying.
1 parent c997020 commit 660a117

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

lib/precompiler.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,6 @@ module.exports.cli = function(opts) {
250250
outSourceMap: opts.map,
251251
inSourceMap: JSON.parse(output.map)
252252
});
253-
if (opts.map) {
254-
output.code += '\n//# sourceMappingURL=' + opts.map + '\n';
255-
}
256253
}
257254

258255
if (opts.map) {

spec/precompiler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,14 @@ describe('precompiler', function() {
152152
Precompiler.cli({templates: [emptyTemplate], map: 'foo.js.map'});
153153

154154
equal(file, 'foo.js.map');
155-
equal(/sourceMappingURL=/.test(log), true);
155+
equal(log.match(/sourceMappingURL=/g).length, 1);
156156
});
157157

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

161161
equal(file, 'foo.js.map');
162-
equal(/sourceMappingURL=/.test(log), true);
162+
equal(log.match(/sourceMappingURL=/g).length, 1);
163163
});
164164

165165
describe('#loadTemplates', function() {

0 commit comments

Comments
 (0)