Commit a63cc366 by Andrew Nesbitt

Merge pull request #396 from am11/omit-comments-gh#380

Option: Omit source mapping url from output file (#380)
parents 28c9018d 6591ef05
...@@ -54,6 +54,7 @@ void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper* ...@@ -54,6 +54,7 @@ void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper*
ctx->options.image_path = CreateString(options->Get(NanNew("imagePath"))); ctx->options.image_path = CreateString(options->Get(NanNew("imagePath")));
ctx->options.output_style = options->Get(NanNew("style"))->Int32Value(); ctx->options.output_style = options->Get(NanNew("style"))->Int32Value();
ctx->options.source_comments = source_comments = options->Get(NanNew("comments"))->Int32Value(); ctx->options.source_comments = source_comments = options->Get(NanNew("comments"))->Int32Value();
ctx->omit_source_map_url = options->Get(NanNew("omitSourceMapUrl"))->BooleanValue();
ctx->options.include_paths = CreateString(options->Get(NanNew("paths"))); ctx->options.include_paths = CreateString(options->Get(NanNew("paths")));
if (source_comments == SASS_SOURCE_COMMENTS_MAP) { if (source_comments == SASS_SOURCE_COMMENTS_MAP) {
ctx->source_map_file = CreateString(options->Get(NanNew("sourceMap"))); ctx->source_map_file = CreateString(options->Get(NanNew("sourceMap")));
...@@ -66,6 +67,7 @@ void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper* ...@@ -66,6 +67,7 @@ void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper*
ctx->options.image_path = CreateString(options->Get(NanNew("imagePath"))); ctx->options.image_path = CreateString(options->Get(NanNew("imagePath")));
ctx->options.output_style = options->Get(NanNew("style"))->Int32Value(); ctx->options.output_style = options->Get(NanNew("style"))->Int32Value();
ctx->options.source_comments = source_comments = options->Get(NanNew("comments"))->Int32Value(); ctx->options.source_comments = source_comments = options->Get(NanNew("comments"))->Int32Value();
ctx->omit_source_map_url = options->Get(NanNew("omitSourceMapUrl"))->BooleanValue();
ctx->options.include_paths = CreateString(options->Get(NanNew("paths"))); ctx->options.include_paths = CreateString(options->Get(NanNew("paths")));
ctx->options.precision = options->Get(NanNew("precision"))->Int32Value(); ctx->options.precision = options->Get(NanNew("precision"))->Int32Value();
} }
......
...@@ -42,6 +42,11 @@ var optimist = require('optimist') ...@@ -42,6 +42,11 @@ var optimist = require('optimist')
describe: 'Print the resulting CSS to stdout', describe: 'Print the resulting CSS to stdout',
type: 'boolean' type: 'boolean'
}) })
.options('omit-source-map-url', {
describe: 'Omit source map URL comment from output',
type: 'boolean',
alias: 'x'
})
.options('help', { .options('help', {
describe: 'Print usage info', describe: 'Print usage info',
type: 'string', type: 'string',
...@@ -87,7 +92,8 @@ exports = module.exports = function(args) { ...@@ -87,7 +92,8 @@ exports = module.exports = function(args) {
}); });
var options = { var options = {
stdout: argv.stdout stdout: argv.stdout,
omitSourceMapUrl: argv['omit-source-map-url']
}; };
var inFile = options.inFile = argv._[0]; var inFile = options.inFile = argv._[0];
......
...@@ -13,6 +13,7 @@ function render(options, emitter) { ...@@ -13,6 +13,7 @@ function render(options, emitter) {
sourceMap: options.sourceMap, sourceMap: options.sourceMap,
precision: options.precision, precision: options.precision,
outFile: options.outFile, outFile: options.outFile,
omitSourceMapUrl: options.omitSourceMapUrl,
success: function(css, sourceMap) { success: function(css, sourceMap) {
var todo = 1; var todo = 1;
......
...@@ -69,6 +69,7 @@ var prepareOptions = function (options) { ...@@ -69,6 +69,7 @@ var prepareOptions = function (options) {
imagePath: options.image_path || options.imagePath || '', imagePath: options.image_path || options.imagePath || '',
style: SASS_OUTPUT_STYLE[options.output_style || options.outputStyle] || 0, style: SASS_OUTPUT_STYLE[options.output_style || options.outputStyle] || 0,
comments: SASS_SOURCE_COMMENTS[sourceComments] || 0, comments: SASS_SOURCE_COMMENTS[sourceComments] || 0,
omitSourceMapUrl: options.omitSourceMapUrl,
stats: stats, stats: stats,
sourceMap: sourceMap, sourceMap: sourceMap,
precision: parseInt(options.precision) || 5, precision: parseInt(options.precision) || 5,
......
...@@ -34,7 +34,7 @@ var sampleCssMapOutputPath = path.join(__dirname, '../sample.css.map'); ...@@ -34,7 +34,7 @@ var sampleCssMapOutputPath = path.join(__dirname, '../sample.css.map');
describe('cli', function() { describe('cli', function() {
it('should print help when run with no arguments', function(done) { it('should print help when run with no arguments', function(done) {
exec('node ' + cliPath, function(err, stdout, stderr) { exec('node ' + cliPath, function(err, stdout, stderr) {
done(assert(stderr.indexOf('Compile .scss files with node-sass') === 0)); done(assert(stderr.trim().indexOf('Compile .scss files with node-sass') === 0));
}); });
}); });
......
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