Skip to content

Instantly share code, notes, and snippets.

@lunaroyster
Last active November 4, 2017 10:36
Show Gist options
  • Save lunaroyster/6944cf02278021b646c5eb69c55cb692 to your computer and use it in GitHub Desktop.
Save lunaroyster/6944cf02278021b646c5eb69c55cb692 to your computer and use it in GitHub Desktop.
const fse = require('fs-extra');
const path = require('path');
const sass = require('node-sass');
function toCSS(scssFileName) {
return scssFileName.replace(".scss", ".css");
}
module.exports = (async (scssFolder, outFolder)=> {
await fse.ensureDir(outFolder);
let scssFileNames = await fse.readdir(scssFolder);
for (let scssFileName of scssFileNames) {
let scssFile = await sass.renderSync({data: (await fse.readFile(scssFolder + scssFileName)).toString()});
await fse.writeFile(outFolder+toCSS(scssFileName), scssFile.css, {flag:'w'});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment