-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake-bundle.js
More file actions
33 lines (24 loc) · 909 Bytes
/
make-bundle.js
File metadata and controls
33 lines (24 loc) · 909 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
26
27
28
29
30
31
32
33
// Bundle Maker for Javascript
// Concats Javascript files before minifying
"use strict";
const Path = require("path");
const FileSystem = require("fs");
function bundleFiles(config) {
const path = Path.resolve(__dirname, config.path);
const outOutStream = FileSystem.createWriteStream(Path.resolve(path, config.target));
if (config.requires) {
for (let req of config.requires) {
outOutStream.write(FileSystem.readFileSync(Path.resolve(path, req)));
}
}
outOutStream.write(FileSystem.readFileSync(Path.resolve(path, config.entry)));
outOutStream.close();
console.log("Created bundle: " + config.name + " / Output: " + config.target);
}
function main() {
const config = JSON.parse(FileSystem.readFileSync(Path.resolve(__dirname, "bundle.config.json")).toString());
for (let entry of config) {
bundleFiles(entry);
}
}
main();