Created
June 17, 2019 21:27
-
-
Save justinemter/5ef4d57caa2da368dddff8790b49d6db to your computer and use it in GitHub Desktop.
Gulp file to resize / rename / optimize images for web.
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
var gulp = require('gulp'); | |
var imageResize = require('gulp-image-resize'); | |
var imagemin = require('gulp-imagemin'); | |
var rename = require('gulp-rename'); | |
gulp.task('default', function(callback) { | |
gulp.src('./**/*.jpg', { base: "./" }) | |
.pipe(imageResize({ | |
format: 'jpeg', | |
width: 2880, | |
imageMagick: false | |
})) | |
.pipe(imagemin({ | |
progressive: true, | |
svgoPlugins: [{ removeViewBox: false }, { removeUselessStrokeAndFill: false }] | |
})) | |
.pipe(rename({ | |
suffix: "-resized", | |
})) | |
.pipe(gulp.dest(".")) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment