Skip to content

Instantly share code, notes, and snippets.

@lennym
Created June 3, 2015 10:27
Show Gist options
  • Save lennym/2c323459f443622b9f71 to your computer and use it in GitHub Desktop.
Save lennym/2c323459f443622b9f71 to your computer and use it in GitHub Desktop.
node-sass build script
#!/usr/bin/env node
var sass = require('node-sass'),
path = require('path'),
fs = require('fs');
var src = path.resolve(__dirname, '../assets/sass/app.scss'),
out = path.resolve(__dirname, '../public/stylesheets/app.css');
sass.render({
file: src,
includePaths: module.paths,
success: function (result) {
fs.writeFile(out, result.css, function (err) {
if (err) { throw err; }
else {
console.log(src, '>', out);
}
})
},
error: function (err) {
console.log(err);
throw new Error(err.message, err.file, err.line);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment