forked from praneshr/react-diff-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile-css.js
37 lines (32 loc) · 835 Bytes
/
compile-css.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const path = require('path');
const fs = require('fs');
const sass = require('sass');
const writeFileAsync = (filepath, data, options) => {
return new Promise((resolve, reject) => {
fs.writeFile(filepath, data, options, (err) => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
};
const main = async () => {
const [light, dark] = await Promise.all([
sass.compileAsync('./src/light.scss'),
sass.compileAsync('./src/dark.scss'),
]);
const outputPath = path.resolve(__dirname, 'lib');
return Promise.all([
writeFileAsync(path.resolve(outputPath, 'light.css'), light.css, 'utf-8'),
writeFileAsync(path.resolve(outputPath, 'dark.css'), dark.css, 'utf-8'),
]);
};
main()
.then(() => {
process.exit(0);
})
.catch(() => {
process.exit(1);
});