-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
48 lines (35 loc) · 941 Bytes
/
build.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
39
40
41
42
43
44
45
46
47
48
/*
* Build script from https://github.com/posabsolute/small-build-script-with-node
*/
/* You need uglify
// npm install -g uglify-js
// npm link uglify-js
// Run that into node and voila
*/
var FILE_ENCODING = 'utf-8',
EOL = '\n';
var _fs = require('fs');
var config = require('./config');
function concat(opts) {
var fileList = opts.src;
var distPath = opts.dest;
var out = fileList.map(function(filePath){
return _fs.readFileSync(filePath, FILE_ENCODING);
});
_fs.writeFileSync(distPath, out.join(EOL), FILE_ENCODING);
console.log(' '+ distPath +' built.');
}
concat({
src : config.fileList,
dest : 'kaya.js'
});
function uglify(srcPath, distPath) {
var
uglyfyJS = require('uglify-js'),
result = uglyfyJS.minify(srcPath);
_fs.writeFileSync(distPath, result.code, FILE_ENCODING);
console.log(' '+ distPath +' built.');
}
uglify('kaya.js', 'kaya.min.js');
console.log("and you're done");
process.exit(1);