mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Add gzip compression, can be disabled in config.js
Closes #1305 - added compression module - added new server config variable: compress - gzip enabled by default
This commit is contained in:
parent
acd71d423e
commit
c7459b1d9f
2 changed files with 8 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
|||
var crypto = require('crypto'),
|
||||
express = require('express'),
|
||||
hbs = require('express-hbs'),
|
||||
compress = require('compression'),
|
||||
fs = require('fs'),
|
||||
uuid = require('node-uuid'),
|
||||
Polyglot = require('node-polyglot'),
|
||||
|
@ -66,7 +67,7 @@ function initDbHashAndFirstRun() {
|
|||
return dbHash;
|
||||
}).then(doFirstRun);
|
||||
}
|
||||
|
||||
|
||||
return dbHash;
|
||||
});
|
||||
}
|
||||
|
@ -218,6 +219,11 @@ function init(server) {
|
|||
// return the correct mime type for woff filess
|
||||
express['static'].mime.define({'application/font-woff': ['woff']});
|
||||
|
||||
// enabled gzip compression by default
|
||||
if (config().server.compress !== false) {
|
||||
server.use(compress());
|
||||
}
|
||||
|
||||
// ## View engine
|
||||
// set the view engine
|
||||
server.set('view engine', 'hbs');
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
"bookshelf": "0.6.8",
|
||||
"busboy": "0.0.12",
|
||||
"colors": "0.6.2",
|
||||
"compression": "^1.0.2",
|
||||
"connect-slashes": "1.2.0",
|
||||
"downsize": "0.0.5",
|
||||
"express": "3.4.6",
|
||||
|
|
Loading…
Reference in a new issue