Last active
November 4, 2017 10:36
-
-
Save lunaroyster/6944cf02278021b646c5eb69c55cb692 to your computer and use it in GitHub Desktop.
This file contains 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
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