Commit 173e8280 by Kevin Martensson

Minor readability improvements

parent 2e61a57a
var sass = require('../sass'),
var fs = require('fs'),
chalk = require('chalk'),
fs = require('fs');
sass = require('../sass');
function render(options, emitter) {
/**
* Render
*
* @param {Object} options
* @param {Object} emitter
* @api public
*/
module.exports = function(options, emitter) {
var renderOptions = {
imagePath: options.imagePath,
includePaths: options.includePath,
......@@ -29,7 +37,7 @@ function render(options, emitter) {
}
};
if (options.stdout || (!options.dest && (!process.stdout.isTTY || !process.env.isTTY))) {
if (options.stdout || (!options.dest && !process.stdout.isTTY)) {
emitter.emit('log', css);
return done();
}
......@@ -37,7 +45,10 @@ function render(options, emitter) {
emitter.emit('warn', chalk.green('Rendering Complete, saving .css file...'));
fs.writeFile(options.dest, css, function(err) {
if (err) { return emitter.emit('error', chalk.red('Error: ' + err)); }
if (err) {
return emitter.emit('error', chalk.red('Error: ' + err));
}
emitter.emit('warn', chalk.green('Wrote CSS to ' + options.dest));
emitter.emit('write', err, options.dest, css);
done();
......@@ -45,8 +56,12 @@ function render(options, emitter) {
if (options.sourceMap) {
todo++;
fs.writeFile(options.sourceMap, sourceMap, function(err) {
if (err) {return emitter.emit('error', chalk.red('Error' + err)); }
if (err) {
return emitter.emit('error', chalk.red('Error' + err));
}
emitter.emit('warn', chalk.green('Wrote Source Map to ' + options.sourceMap));
emitter.emit('write-source-map', err, options.sourceMap, sourceMap);
done();
......@@ -61,6 +76,4 @@ function render(options, emitter) {
};
sass.render(renderOptions);
}
module.exports = render;
};
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