Commit 3fffef75 by Stephen Rivas JR

Added bin information for npm link so you can utilize:

node-sass sass.scss output.css

Where sass.scss is the Sass file to compilte, and output.css is the filename to output.

Added fs.writeFile functionality to the node-sass bin, so that output if read in and compiled correct are then output to the filesystem based on the given arguments. Default output file is "nodesass.scss"

Did not add additional tests for this, lame.
parent ac057140
......@@ -3,6 +3,9 @@ var colors = require('colors');
var fs = require('fs');
var sass = require('../sass');
var fileName = process.argv[2];
var cssFileName = process.argv[3];
console.log('Starting Render Process...'.green);
if (fileName) {
fs.readFile(fileName, "utf8", function(err, data) {
......@@ -10,6 +13,7 @@ if (fileName) {
console.log("** Error Opening File **".red);
console.log(JSON.stringify(err, null, 4).yellow);
} else {
console.log('File data read successfully, rendering css'.green);
renderSASS(data);
}
});
......@@ -23,7 +27,21 @@ function renderSASS(data) {
console.log("** Error Rendering SASS **".red);
console.log(JSON.stringify(err, null, 4).yellow);
} else {
console.log(compiled);
console.log('Rendering Complete, saving .css file...'.green);
var outFile = (cssFileName) ? cssFileName : 'nodesass.css';
writeCssFile(outFile, compiled);
}
});
}
function writeCssFile(filename, data) {
fs.writeFile(filename, data, function(err){
if(err) {
console.log('Error: ' + err);
} else {
console.log('File saved! New .css file: ' + filename);
}
});
}
\ No newline at end of file
......@@ -13,6 +13,9 @@
"install": "node rebuild.js",
"test": "mocha test"
},
"bin": {
"node-sass" : "bin/node-sass"
},
"gypfile": true,
"engines": {
"node": ">=0.6.18"
......
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