Skip to content

Commit e0ce2b4

Browse files
authored
Merge pull request #250 from cevou/sourcemaps-path
Fix file path in source maps
2 parents ad89943 + e0923ab commit e0ce2b4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ module.exports = function (content) {
224224
// deliberately overriding the sourceMap option
225225
// this value is (currently) ignored by libsass when using the data input instead of file input
226226
// however, it is still necessary for correct relative paths in result.map.sources
227-
sassOptions.sourceMap = this.options.output.path + '/sass.map';
227+
sassOptions.sourceMap = this.options.context + '/sass.map';
228228
sassOptions.omitSourceMapUrl = true;
229229

230230
// If sourceMapContents option is not set, set it to true otherwise maps will be empty/null
@@ -278,7 +278,8 @@ module.exports = function (content) {
278278
result.map.file = resourcePath;
279279
// The first source is 'stdin' according to libsass because we've used the data input
280280
// Now let's override that value with the correct relative path
281-
result.map.sources[0] = path.relative(self.options.output.path, resourcePath);
281+
result.map.sources[0] = path.relative(self.options.context, resourcePath);
282+
result.map.sourceRoot = path.relative(self.options.context, process.cwd());
282283
} else {
283284
result.map = null;
284285
}

0 commit comments

Comments
 (0)