Added compression

This commit is contained in:
Marcus Noble 2016-05-27 06:04:05 +01:00
parent a2e3afb01d
commit 58bedb277d
2 changed files with 8 additions and 0 deletions

7
app.js
View File

@ -2,6 +2,7 @@
const fs = require('fs'); const fs = require('fs');
const https = require('https'); const https = require('https');
const express = require('express'); const express = require('express');
const compress = require('compression');
const app = express(); const app = express();
const Metalsmith = require('metalsmith'); const Metalsmith = require('metalsmith');
const inplace = require('metalsmith-in-place'); const inplace = require('metalsmith-in-place');
@ -20,6 +21,7 @@ const moment = require('moment');
const port = process.env.PORT || 8000; const port = process.env.PORT || 8000;
app.use(express.static(__dirname + '/build')); app.use(express.static(__dirname + '/build'));
app.use(compress());
var md = markdown('commonmark', {html: true}); var md = markdown('commonmark', {html: true});
md.parser.use(emoji); md.parser.use(emoji);
@ -51,6 +53,11 @@ Metalsmith(__dirname)
}, },
pages: { pages: {
pattern: 'pages/*' pattern: 'pages/*'
},
experience: {
pattern: 'experience/*',
sortBy: 'start',
reverse: true
} }
})) }))
.use(inplace({ .use(inplace({

View File

@ -5,6 +5,7 @@
"start": "node app.js" "start": "node app.js"
}, },
"dependencies": { "dependencies": {
"compression": "^1.6.2",
"express": "^4.13.4", "express": "^4.13.4",
"handlebars": "^4.0.5", "handlebars": "^4.0.5",
"markdown-it-emoji": "^1.1.1", "markdown-it-emoji": "^1.1.1",