From 3049911017a632d574af4f24ed7a95df69d1410b Mon Sep 17 00:00:00 2001 From: xzyfer Date: Tue, 24 Apr 2018 20:25:42 +1000 Subject: [PATCH] Respect quiet option in Node API This is an extension of #2268. Catches a few places missed the first time around. --- bin/node-sass | 6 ++++++ lib/render.js | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/node-sass b/bin/node-sass index 62abdb229..5f1a8d650 100755 --- a/bin/node-sass +++ b/bin/node-sass @@ -161,6 +161,12 @@ function getEmitter() { } }); + emitter.on('info', function(data) { + if (!options.quiet) { + console.info(data); + } + }); + emitter.on('log', stdout.write.bind(stdout)); return emitter; diff --git a/lib/render.js b/lib/render.js index d7a45d78f..858e02e74 100644 --- a/lib/render.js +++ b/lib/render.js @@ -64,7 +64,7 @@ module.exports = function(options, emitter) { return done(); } - emitter.emit('warn', chalk.green('Rendering Complete, saving .css file...')); + emitter.emit('info', chalk.green('Rendering Complete, saving .css file...')); mkdirp(path.dirname(destination), function(err) { if (err) { @@ -76,7 +76,7 @@ module.exports = function(options, emitter) { return emitter.emit('error', chalk.red(err)); } - emitter.emit('warn', chalk.green('Wrote CSS to ' + destination)); + emitter.emit('info', chalk.green('Wrote CSS to ' + destination)); emitter.emit('write', err, destination, result.css.toString()); done(); }); @@ -94,7 +94,7 @@ module.exports = function(options, emitter) { return emitter.emit('error', chalk.red('Error' + err)); } - emitter.emit('warn', chalk.green('Wrote Source Map to ' + sourceMap)); + emitter.emit('info', chalk.green('Wrote Source Map to ' + sourceMap)); emitter.emit('write-source-map', err, sourceMap, result.map); done(); });