Browse Source

Minify HTTP server's response HTML

pull/6/head
Menci 6 years ago
parent
commit
cc302b5d57
  1. 13
      app.js
  2. 1
      package.json

13
app.js

@ -169,6 +169,19 @@ global.syzoj = {
} }
app.use(Session(sessionConfig)); app.use(Session(sessionConfig));
app.use(require('express-minify-html')({
override: true,
htmlMinifier: {
removeComments: true,
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeAttributeQuotes: true,
removeEmptyAttributes: true,
minifyJS: true,
minifyCSS: true
}
}));
app.use((req, res, next) => { app.use((req, res, next) => {
res.locals.useLocalLibs = !!parseInt(req.headers['syzoj-no-cdn']); res.locals.useLocalLibs = !!parseInt(req.headers['syzoj-no-cdn']);

1
package.json

@ -34,6 +34,7 @@
"download": "^7.1.0", "download": "^7.1.0",
"ejs": "^2.5.2", "ejs": "^2.5.2",
"express": "^4.14.0", "express": "^4.14.0",
"express-minify-html": "^0.12.0",
"express-session": "^1.14.1", "express-session": "^1.14.1",
"file-size": "^1.0.0", "file-size": "^1.0.0",
"fs-extra": "^7.0.1", "fs-extra": "^7.0.1",

Loading…
Cancel
Save