Last active
March 2, 2016 00:58
-
-
Save caraya/f2ef2eeb7978acba14dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gulp.task('images', function () { | |
return gulp.src('[app/images/**/*.{jpg,png}]') | |
.pipe($.responsive({ | |
// Resize all JPG images to three different sizes: 200, 500, and 630 pixels | |
'*.jpg': [{ | |
width: 200, | |
rename: { suffix: '-200px' } | |
}, { | |
width: 500, | |
rename: { suffix: '-500px' } | |
}, { | |
width: 630, | |
rename: { suffix: '-630px' } | |
}, { | |
// Compress, strip metadata, and rename original image | |
rename: { suffix: '-original' } | |
}], | |
// Resize all PNG images to be retina ready | |
'*.png': [{ | |
width: 250 | |
}, { | |
width: 250 * 2, | |
rename: { suffix: '@2x' } | |
}] | |
}, { | |
// Global configuration for all images | |
// Strip all metadata | |
withMetadata: false | |
})) | |
.pipe(imagemin({ | |
progressive: true, | |
svgoPlugins: [{removeViewBox: false}], | |
use: [ mozjpeg() ] | |
})) | |
.pipe(webp({quality: 50})()) | |
.pipe(gulp.dest('dist/images')) | |
.pipe($.size({ | |
pretty: true, | |
title: 'processImages' | |
})); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment