forked from snowplow/snowplow-javascript-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminify.js
More file actions
25 lines (21 loc) · 716 Bytes
/
Copy pathminify.js
File metadata and controls
25 lines (21 loc) · 716 Bytes
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
const fs = require('fs');
const UglifyJS = require('uglify-js');
const options = {
compress: true,
mangle: true,
output: {
max_line_len: 500
//preamble: "/* uglified */"
}
};
const resultTag = UglifyJS.minify(fs.readFileSync(process.cwd() + "/tags/tag.js", "utf8"), options);
const resultSnowplow = UglifyJS.minify(fs.readFileSync(process.cwd() + "/dist/bundles/snowplow-second.js", "utf8"), options);
fs.writeFileSync("dist/min/tag.js", resultTag.code, "utf8");
fs.writeFileSync("dist/min/sp.js", resultSnowplow.code, "utf8");
if (resultTag.error !== undefined) {
console.log(resultTag.error);
}
if (resultSnowplow.error !== undefined) {
console.log(resultSnowplow.error);
}
process.exit(0);