-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.js
33 lines (30 loc) · 984 Bytes
/
make.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
/* GoldDice / make.js
* echo 'make script for GoldDice' && node make
* (c) 2015 David (daXXog) Volm ><> + + + <><
* Released under Apache License, Version 2.0:
* http://www.apache.org/licenses/LICENSE-2.0.html
*/
var bitfactory = require('bitfactory'),
UglifyJS = require("uglify-js"),
stoptime = require('stoptime'),
fs = require('fs');
var watch = stoptime(),
header = '';
bitfactory.make({ //routes
"": function(err, results) {
console.log('built GoldDice in ' + watch.elapsed() + 'ms.');
}
}, { //dependencies
"*": { //wildcard
"header": function(cb) {
fs.readFile('gold-dice.h', 'utf8', function(err, data) {
header = data;
cb(err);
});
},
"gold-dice.min.js": ["header", function(cb) {
fs.writeFileSync('gold-dice.min.js', header + UglifyJS.minify('gold-dice.js').code);
cb();
}]
}
});