html minify in production environment
This commit is contained in:
parent
0b9c177058
commit
731375c220
2 changed files with 14 additions and 0 deletions
13
app.js
13
app.js
|
@ -17,6 +17,7 @@ var morgan = require('morgan');
|
||||||
var passportSocketIo = require("passport.socketio");
|
var passportSocketIo = require("passport.socketio");
|
||||||
var helmet = require('helmet');
|
var helmet = require('helmet');
|
||||||
var i18n = require('i18n');
|
var i18n = require('i18n');
|
||||||
|
var minifyHTML = require('express-minify-html');
|
||||||
|
|
||||||
//core
|
//core
|
||||||
var config = require("./lib/config.js");
|
var config = require("./lib/config.js");
|
||||||
|
@ -56,6 +57,18 @@ app.use(morgan('combined', {
|
||||||
"stream": logger.stream
|
"stream": logger.stream
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
if (!config.debug) {
|
||||||
|
app.use(minifyHTML({
|
||||||
|
override: false,
|
||||||
|
htmlMinifier: {
|
||||||
|
removeComments: true,
|
||||||
|
collapseWhitespace: true,
|
||||||
|
collapseBooleanAttributes: true,
|
||||||
|
removeAttributeQuotes: true,
|
||||||
|
removeEmptyAttributes: true,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
//socket io
|
//socket io
|
||||||
var io = require('socket.io')(server);
|
var io = require('socket.io')(server);
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
"ejs": "^2.5.2",
|
"ejs": "^2.5.2",
|
||||||
"engine.io-client": "^1.7.0",
|
"engine.io-client": "^1.7.0",
|
||||||
"express": ">=4.14",
|
"express": ">=4.14",
|
||||||
|
"express-minify-html": "^0.6.0",
|
||||||
"express-session": "^1.14.1",
|
"express-session": "^1.14.1",
|
||||||
"file-saver": "^1.3.3",
|
"file-saver": "^1.3.3",
|
||||||
"flowchart.js": "^1.6.3",
|
"flowchart.js": "^1.6.3",
|
||||||
|
|
Loading…
Reference in a new issue