Commit 2b070e74 by Nick Schonning

Smart defaults when only source-comment=map used

Instead of just emitting `/*# sourceMappingURL=undefined */`, act like
`--source-map` option was passed
parent fd79dcd9
...@@ -109,6 +109,11 @@ exports = module.exports = function(args) { ...@@ -109,6 +109,11 @@ exports = module.exports = function(args) {
options.sourceComments = options.sourceComments[0]; options.sourceComments = options.sourceComments[0];
} }
// Set the sourceMap path if the sourceComment was 'map', but set source-map was missing
if (options.sourceComments === 'map' && !argv['source-map']) {
argv['source-map'] = true;
}
// set source map file and set sourceComments to 'map' // set source map file and set sourceComments to 'map'
if (argv['source-map']) { if (argv['source-map']) {
options.sourceComments = 'map'; options.sourceComments = 'map';
......
...@@ -138,4 +138,22 @@ describe('cli', function() { ...@@ -138,4 +138,22 @@ describe('cli', function() {
}); });
}); });
it('should compile a sourceMap if --source-comments="map", but the --source-map option is excluded', function(done){
var emitter = cli([path.join(__dirname, 'sample.scss'), '--source-comments', 'map']);
emitter.on('error', done);
emitter.on('write-source-map', function(err, file) {
assert.equal(file, path.join(__dirname, '../sample.css.map'));
fs.exists(file, function(exists) {
assert(exists);
});
});
emitter.on('done', function() {
fs.unlink(path.join(__dirname, '../sample.css.map'), function() {
fs.unlink(path.join(__dirname, '../sample.css'), function() {
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