Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,20 @@ module.exports = function(grunt) {
]
}
},
sourcemap4_options: {
options: {
sourceMap: true,
sourceMapName: 'tmp/sourcemap4_embed_map.map',
sourceMapRoot: 'file://tmp'
},
files: {
'tmp/sourcemap4_embed': [
'test/fixtures/mappedsource_embed',
'test/fixtures/file1',
'test/fixtures/file2'
]
}
},
sourcemap_js: {
options: {
banner: '/*\nJS Banner\n*/\n',
Expand Down
3 changes: 2 additions & 1 deletion tasks/concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ module.exports = function(grunt) {
process: false,
sourceMap: false,
sourceMapName: undefined,
sourceMapStyle: 'embed'
sourceMapStyle: 'embed',
sourceMapRoot: undefined
});

// Normalize boolean options that accept options objects.
Expand Down
3 changes: 2 additions & 1 deletion tasks/lib/sourcemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ exports.init = function(grunt) {
// ensure we're using forward slashes, because these are URLs
var file = path.relative(path.dirname(this.dest), this.files.dest).replace(/\\/g, '/');
var generator = new SourceMapGenerator({
file: file
file: file,
sourceRoot: this.options.sourceMapRoot
});
this.file = file;
this.generator = generator;
Expand Down
6 changes: 5 additions & 1 deletion test/concat_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ exports.concat = {
test.done();
},
sourcemap_options: function(test) {
test.expect(5);
test.expect(6);

var actual = getNormalizedFile('tmp/sourcemap_inline');
var expected = getNormalizedFile('test/expected/sourcemap_inline');
Expand All @@ -105,6 +105,10 @@ exports.concat = {
expected = getNormalizedFile('test/expected/sourcemap_css.css.map');
test.equal(actual, expected, 'should output the css map.');

actual = getNormalizedFile('tmp/sourcemap4_embed_map.map');
expected = getNormalizedFile('test/expected/sourcemap4_embed_map.map');
test.equal(actual, expected, 'should include sourceRoot.');

test.done();
}
};
1 change: 1 addition & 0 deletions test/expected/sourcemap4_embed_map.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.