-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrender.js
More file actions
27 lines (22 loc) · 921 Bytes
/
render.js
File metadata and controls
27 lines (22 loc) · 921 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
const ejs = require("ejs");
const config = require("./config.json");
const fs = require("fs");
const minify = require('@node-minify/core');
const htmlMinifier = require('@node-minify/html-minifier');
async function main() {
config.revision = require('child_process').execSync('git rev-parse HEAD').toString().trim();
config.site.revisionTime = require('child_process').execSync('git log -1 --format=%at').toString().trim();
fs.writeFileSync("./public/index.html", await ejs.renderFile("./views/index.ejs", config));
fs.writeFileSync("./public/app.html", await ejs.renderFile("./views/app.ejs", config));
minify({
compressor: htmlMinifier,
input: "./public/index.html",
output: "./public/index.min.html"
}).then();
minify({
compressor: htmlMinifier,
input: "./public/app.html",
output: "./public/app.min.html"
}).then();
}
main().then();