Skip to content

Instantly share code, notes, and snippets.

@simonhaenisch
Created August 20, 2016 10:36
Show Gist options
  • Save simonhaenisch/3e5a68eb9f00af0d254f59910cf71f12 to your computer and use it in GitHub Desktop.
Save simonhaenisch/3e5a68eb9f00af0d254f59910cf71f12 to your computer and use it in GitHub Desktop.
Build SCSS with the `node-sass` npm module
// 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