Skip to content

Commit 73e54c4

Browse files
committed
Changed to add compression in development
1 parent 11bb66e commit 73e54c4

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

lib/config/express.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,27 @@ module.exports = function(app) {
2121
var env = app.get('env');
2222

2323
if ('development' === env) {
24-
app.use(require('connect-livereload')());
24+
// app.use(require('connect-livereload')());
2525

26-
// Disable caching of scripts for easier testing
27-
app.use(function noCache(req, res, next) {
28-
if (req.url.indexOf('/scripts/') === 0) {
29-
res.header('Cache-Control', 'no-cache, no-store, must-revalidate');
30-
res.header('Pragma', 'no-cache');
31-
res.header('Expires', 0);
26+
app.use(compression({
27+
filter: function (req, res) {
28+
if (req.headers['x-no-compression']) {
29+
return false;
30+
}
31+
32+
return true;
3233
}
33-
next();
34-
});
34+
}));
35+
36+
// Disable caching of scripts for easier testing
37+
// app.use(function noCache(req, res, next) {
38+
// if (req.url.indexOf('/scripts/') === 0) {
39+
// res.header('Cache-Control', 'no-cache, no-store, must-revalidate');
40+
// res.header('Pragma', 'no-cache');
41+
// res.header('Expires', 0);
42+
// }
43+
// next();
44+
// });
3545

3646
app.use(express.static(path.join(config.root, '.tmp')));
3747
app.use(express.static(path.join(config.root, 'app')));

0 commit comments

Comments
 (0)