Commit 67ea9c58 by Adeel

Source-map: Parse as JSON.

parent d58c303c
......@@ -164,6 +164,8 @@ function getOptions(options) {
};
options.success = function(css, sourceMap) {
sourceMap = JSON.parse(sourceMap);
endStats(options, sourceMap);
if (success) {
......@@ -254,7 +256,7 @@ module.exports.renderSync = function(options) {
options = getOptions(options);
output = options.file ? binding.renderFileSync(options) : binding.renderSync(options);
endStats(options, options.stats.sourceMap);
endStats(options, JSON.parse(options.stats.sourceMap));
return output;
};
......@@ -296,7 +298,7 @@ module.exports.renderFile = function(options) {
var dir = path.dirname(outFile);
var sourceMapFile = path.resolve(dir, options.sourceMap);
fs.writeFile(sourceMapFile, sourceMap, function(err) {
fs.writeFile(sourceMapFile, JSON.stringify(sourceMap), function(err) {
if (err) {
return options.error(err);
}
......
......@@ -421,8 +421,7 @@ describe('api', function() {
stats: stats,
sourceMap: true,
success: function() {
var map = JSON.parse(stats.sourceMap);
assert.equal(map.sources[0], 'index.scss');
assert.equal(stats.sourceMap.sources[0], 'index.scss');
done();
}
});
......@@ -516,8 +515,7 @@ describe('api', function() {
sourceMap: true
});
var map = JSON.parse(stats.sourceMap);
assert.equal(map.sources[0], 'index.scss');
assert.equal(stats.sourceMap.sources[0], 'index.scss');
done();
});
});
......
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