forked from openstreetmap/iD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_css.js
37 lines (33 loc) · 1.01 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
/* eslint-disable no-console */
const glob = require('glob');
const concat = require('concat-files');
const colors = require('colors/safe');
module.exports = function buildCSS() {
var building = false;
return function () {
if (building) return;
console.log('building css');
console.time(colors.green('css built'));
building = true;
return concatFilesProm('css/**/*.css', 'dist/iD.css')
.then(function () {
console.timeEnd(colors.green('css built'));
building = 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();
});
});
});
}