Last active
March 21, 2018 07:20
-
-
Save LiYiBin/aac9cba475f3e4ff05bd946fdf51c64c 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
// Helpers | |
const recursiveCompiling = (path, outputPath, funcName, appendedPath = '') => { | |
const dirPath = `${path}${appendedPath}`; | |
const filenames = fs.readdirSync(dirPath); | |
filenames | |
.filter(filename => !(filename.charAt(0) === '_')) | |
.filter(filename => !(filename.charAt(0) === '.')) | |
.forEach(filename => { | |
const filePath = `${path}${appendedPath}/${filename}`; | |
const isFile = fs.lstatSync(filePath).isFile(); | |
if (isFile) { | |
const compilingPath = `${path}${appendedPath}/${filename}`; | |
const compilingOutputPath = `${outputPath}${appendedPath}`; | |
mix[funcName](compilingPath, compilingOutputPath); | |
} else { | |
const newAppendedPath = `${appendedPath}/${filename}`; | |
recursiveCompiling(path, outputPath, funcName, newAppendedPath); | |
} | |
}); | |
} | |
// Compiling Sass | |
const sassPath = 'resources/assets/sass'; | |
const sassOuputPath = 'public/css'; | |
recursiveCompiling(sassPath, sassOuputPath, 'sass'); | |
// Compiling Javascript | |
const jsPath = 'resources/assets/js'; | |
const jsOuputPath = 'public/js'; | |
recursiveCompiling(jsPath, jsOuputPath, 'js'); | |
// Versioning | |
mix.version(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment