Added imagemin

This commit is contained in:
Marcus Noble 2016-05-27 06:25:28 +01:00
parent aed5fe00cc
commit 385a0c5327
2 changed files with 9 additions and 0 deletions

7
app.js
View File

@ -14,9 +14,11 @@ const pagination = require('metalsmith-pagination');
const define = require('metalsmith-define'); const define = require('metalsmith-define');
const feed = require('metalsmith-feed'); const feed = require('metalsmith-feed');
const sass = require('metalsmith-sass'); const sass = require('metalsmith-sass');
const imagemin = require('metalsmith-imagemin');
const Handlebars = require('handlebars'); const Handlebars = require('handlebars');
const emoji = require('markdown-it-emoji'); const emoji = require('markdown-it-emoji');
const moment = require('moment'); const moment = require('moment');
const imageminMozjpeg = require('imagemin-mozjpeg');
const port = process.env.PORT || 8000; const port = process.env.PORT || 8000;
const oneDay = 86400000; const oneDay = 86400000;
@ -99,6 +101,11 @@ Metalsmith(__dirname)
partials: 'templates/partials' partials: 'templates/partials'
})) }))
.use(sass()) .use(sass())
.use(imagemin({
plugins: [
imageminMozjpeg({progressive: true})
]
}))
.build(function(err) { .build(function(err) {
if (err) throw err; if (err) throw err;

View File

@ -8,11 +8,13 @@
"compression": "^1.6.2", "compression": "^1.6.2",
"express": "^4.13.4", "express": "^4.13.4",
"handlebars": "^4.0.5", "handlebars": "^4.0.5",
"imagemin-mozjpeg": "^6.0.0",
"markdown-it-emoji": "^1.1.1", "markdown-it-emoji": "^1.1.1",
"metalsmith": "^2.1.0", "metalsmith": "^2.1.0",
"metalsmith-collections": "^0.7.0", "metalsmith-collections": "^0.7.0",
"metalsmith-define": "^2.0.1", "metalsmith-define": "^2.0.1",
"metalsmith-feed": "^0.2.0", "metalsmith-feed": "^0.2.0",
"metalsmith-imagemin": "^1.2.0",
"metalsmith-in-place": "^1.4.4", "metalsmith-in-place": "^1.4.4",
"metalsmith-layouts": "^1.6.5", "metalsmith-layouts": "^1.6.5",
"metalsmith-markdownit": "^0.3.0", "metalsmith-markdownit": "^0.3.0",