Created
August 20, 2016 10:36
-
-
Save simonhaenisch/3e5a68eb9f00af0d254f59910cf71f12 to your computer and use it in GitHub Desktop.
Build SCSS with the `node-sass` npm module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install node-sass | |
var fs = require('fs'), | |
sass = require('node-sass'); | |
// specify in-/output files | |
var inFile = '/path/to/main.scss', | |
outFile = '/path/to/main.css'; | |
sass.render( | |
{ | |
file: inFile, | |
outputStyle: 'nested' // can also be 'expanded', 'compact' or 'compressed' | |
}, | |
function (err, res) | |
{ | |
if (err) { return console.error("Couldn't render", err); } | |
fs.writeFile(outFile, res.css.toString(), function (err) | |
{ | |
if (err) { return console.error("Couldn't write to disk", err); } | |
console.log("done"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment