1
0
mirror of https://github.com/kremalicious/blog.git synced 2025-02-14 21:10:25 +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 layout: post
title: '"We Are Out Of Whale Oil"' title: We Are Out Of Whale Oil
image: Teaser-Out-Of-Whale-Oil.jpg image: Teaser-Out-Of-Whale-Oil.jpg
download: out-of-whale-oil-wall-by-kremalicious.zip download: out-of-whale-oil-wall-by-kremalicious.zip
author: Matthias Kretschmann 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([ return gulp.src([
dist + '/**/*.{png,jpg,jpeg,gif,svg}', dist + '/**/*.{png,jpg,jpeg,gif,svg,webp}',
'!' + dist + '/media/**/*' '!' + dist + '/media/**/*'
]) ])
.pipe($.cache($.imagemin({ .pipe($.cache($.imagemin({
@ -375,7 +404,9 @@ gulp.task('build', function(cb) {
'revision', 'revision',
'revision-replace', 'revision-replace',
'cdn', 'cdn',
'imagemin', 'optimize:html',
'optimize:gzip',
'optimize:images',
cb cb
); );
}); });

View File

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