-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.js
40 lines (35 loc) · 1.65 KB
/
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
var fs = require('fs');
var minimize = require('minimize');
var node_minify = require('node-minify');
var html_mini = new minimize({
empty: true, // KEEP empty attributes
cdata: true, // KEEP CDATA from scripts
ssi: true, // KEEP Server Side Includes
conditionals: true, // KEEP conditional internet explorer comments
spare: true, // KEEP redundant attributes
quotes: true, // KEEP arbitrary quotes
//loose: true, // KEEP one space
dom: { // options of !(htmlparser2)[https://github.com/fb55/htmlparser2]
xmlMode: false, // Disables the special behavior for script/style tags (false by default)
lowerCaseAttributeNames: true, // call .toLowerCase for each attribute name (true if xmlMode is `false`)
lowerCaseTags: true // call .toLowerCase for each tag name (true if xmlMode is `false`)
}
});
var head_msg = '// This file was automatically generated by build.js from send-btc.js.in.\n';
fs.readFile('modal.html', 'utf8', function(err, html) {
html_mini.parse(html, function(err, html) {
fs.readFile('send-btc.js.in', 'utf8', function(err, js) {
fs.writeFile('send-btc.js', head_msg + js.replace('@MODAL_HTML@', html),
function(err) {
new node_minify.minify({
type: 'yui-js',
fileIn: 'send-btc.js',
fileOut: 'send-btc.min.js',
callback: function(err, min) {
console.log(err);
}
});
});
});
});
});