-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathdist.js
23 lines (18 loc) · 912 Bytes
/
dist.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const sass = require('node-sass');
const config = require('./motley.config.json');
const fs = require('fs')
const writeToDisc = function (result, outFileCss){
fs.writeFileSync(outFileCss, result.css.toString(), {recursive: true})
}
config.applications.map(app => {
const file = `sass/styles/applications/${app}/app.scss`
const outFileCss = `dist/${app}/app.css`
const outFileScss = `dist/${app}/scss/app.scss`
const outFileCssMin = `dist/${app}/app.min.css`
fs.mkdirSync(`dist/${app}/scss`, { recursive: true })
writeToDisc(sass.renderSync({file}), outFileCss)
writeToDisc(sass.renderSync({file, outputStyle: 'compressed'}), outFileCssMin)
fs.writeFileSync(outFileScss, fs.readFileSync(file, 'utf-8'))
})
writeToDisc(sass.renderSync({file: 'sass/styles/app.scss'}), 'dist/app.css')
writeToDisc(sass.renderSync({file: 'sass/styles/app.scss', outputStyle:'compressed'}), 'dist/app.min.css')