forked from facebook/Rapid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_css.js
38 lines (33 loc) · 1.02 KB
/
build_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
38
/* eslint-disable no-console */
const colors = require('colors/safe');
const concat = require('concat-files');
const glob = require('glob');
module.exports = function buildCSS() {
var isBuilding = false;
return function () {
if (isBuilding) return;
console.log('building css');
console.time(colors.green('css built'));
isBuilding = true;
return concatFilesProm('css/**/*.css', 'dist/iD.css')
.then(function () {
console.timeEnd(colors.green('css built'));
isBuilding = false;
})
.catch(function (err) {
console.error(err);
process.exit(1);
});
};
};
function concatFilesProm(globPath, output) {
return new Promise(function (res, rej) {
glob(globPath, function (er, files) {
if (er) return rej(er);
concat(files, output, function (err) {
if (err) return rej(err);
res();
});
});
});
}