1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-13 16:45:14 +01:00

minimize all the things

This commit is contained in:
Matthias Kretschmann 2015-06-10 23:39:55 +02:00
parent 968ca5fff8
commit 57d548ebd3
3 changed files with 38 additions and 5 deletions

View File

@ -1,7 +1,7 @@
---
layout: post
title: '"We Are Out Of Whale Oil"'
title: We Are Out Of Whale Oil
image: Teaser-Out-Of-Whale-Oil.jpg
download: out-of-whale-oil-wall-by-kremalicious.zip
author: Matthias Kretschmann

View File

@ -253,11 +253,40 @@ gulp.task('media', function() {
//
// Image optimization
// Gzip all the things
//
gulp.task('imagemin', function() {
gulp.task('optimize:gzip', function() {
return gulp.src(dist + '/**/*.{html,xml,json,css,js}')
.pipe($.gzip())
.pipe(gulp.dest(dist))
});
//
// Optimize HTML
//
gulp.task('optimize:html', function() {
return gulp.src(dist + '/**/*.html')
.pipe($.htmlmin({
collapseWhitespace: true,
conservativeCollapse: true,
removeComments: true,
useShortDoctype: true,
collapseBooleanAttributes: true,
removeRedundantAttributes: true,
removeEmptyAttributes: true,
removeEmptyAttributes: true
}))
.pipe(gulp.dest(dist));
});
//
// Optimize images
//
gulp.task('optimize:images', function() {
return gulp.src([
dist + '/**/*.{png,jpg,jpeg,gif,svg}',
dist + '/**/*.{png,jpg,jpeg,gif,svg,webp}',
'!' + dist + '/media/**/*'
])
.pipe($.cache($.imagemin({
@ -375,7 +404,9 @@ gulp.task('build', function(cb) {
'revision',
'revision-replace',
'cdn',
'imagemin',
'optimize:html',
'optimize:gzip',
'optimize:images',
cb
);
});

View File

@ -32,7 +32,9 @@
"gulp-connect": ">=2.0.5",
"gulp-cssmin": ">=0.1.7",
"gulp-filter": "^2.0.2",
"gulp-gzip": ">=1.1.0",
"gulp-header": ">=1.2.2",
"gulp-htmlmin": ">=1.1.2",
"gulp-imagemin": ">=2.2.1",
"gulp-load-plugins": ">=0.10.0",
"gulp-rename": ">=1.2.2",