-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jakefile.js
37 lines (30 loc) · 1 KB
/
Jakefile.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
desc('Glue and compile');
task('compress', [], function(params) {
var fs = require('fs');
var javascript = '(function() {\n';
[ 'shiterator.js',
'errorstorage.js',
'errorhandler.js',
'jsontostring.js',
'utils.js'
].forEach(function(file) {
javascript += fs.readFileSync('./library/shiterator/' + file) + "\n\n";
});
javascript += '})();\n\n';
fs.writeFile('./library/shiterator.js', javascript);
console.log('shiterator.js created.');
var compressor = require('node-minify');
new compressor.minify({
type: 'gcc',
fileIn: './library/shiterator.js',
fileOut: './library/shiterator.min.js',
callback: function(err){
if (err) {
console.log(err);
} else {
var compressed = fs.readFileSync('./library/shiterator.min.js');
console.log('shiterator.min.js created. Rate ' + (javascript.length / compressed.length).toFixed(2) + '.');
}
}
});
});