Commit fd6a201d by Adeel

SourceMaps: Don't fix map generated by upstream.

parent 47085e57
...@@ -140,14 +140,6 @@ exports.renderSync = function(options) { ...@@ -140,14 +140,6 @@ exports.renderSync = function(options) {
return output; return output;
}; };
var makeSourceMapUrlsRelative = function (sourceMap, dir) {
var map = JSON.parse(sourceMap);
map.sources = map.sources.map(function (source) {
return path.relative(dir, source);
});
return JSON.stringify(map);
};
/** /**
Same as `render()` but with an extra `outFile` property in `options` and writes Same as `render()` but with an extra `outFile` property in `options` and writes
the CSS and sourceMap (if requested) to the filesystem. the CSS and sourceMap (if requested) to the filesystem.
...@@ -166,7 +158,7 @@ exports.renderFile = function(options) { ...@@ -166,7 +158,7 @@ exports.renderFile = function(options) {
options = assign({}, options); options = assign({}, options);
success = options.success; success = options.success;
if (options.sourceMap === true) { if (options.sourceMap === true) {
options.sourceMap = path.basename(options.outFile) + '.map'; options.sourceMap = options.outFile + '.map';
} }
options.success = function(css, sourceMap) { options.success = function(css, sourceMap) {
fs.writeFile(options.outFile, css, function(err) { fs.writeFile(options.outFile, css, function(err) {
...@@ -178,7 +170,6 @@ exports.renderFile = function(options) { ...@@ -178,7 +170,6 @@ exports.renderFile = function(options) {
if (options.sourceMap) { if (options.sourceMap) {
dir = path.dirname(options.outFile); dir = path.dirname(options.outFile);
sourceMapFile = path.resolve(dir, options.sourceMap); sourceMapFile = path.resolve(dir, options.sourceMap);
sourceMap = makeSourceMapUrlsRelative(sourceMap, path.dirname(sourceMapFile));
fs.writeFile(sourceMapFile, sourceMap, function(err) { fs.writeFile(sourceMapFile, sourceMap, function(err) {
if (err) { if (err) {
return options.error(err); return options.error(err);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment