Last active
September 21, 2016 20:40
-
-
Save aarongustafson/de368a73205d68436bb49c40a8f9fb17 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
var gulp = require('gulp'), | |
newer = require('gulp-newer'), | |
imagemin = require('gulp-imagemin'), | |
notify = require('gulp-notify'), | |
webp = require('gulp-webp'); | |
gulp.task('images', function() { | |
var source = './source/images', | |
destination = './deploy/i'; | |
// Optimize & move | |
gulp.src( source + '/**/*.{jpg,png,svg,gif}') | |
// Only new stuff | |
.pipe(newer(destination)) | |
// Optimize | |
.pipe(imagemin()) | |
// Copy | |
.pipe(gulp.dest(destination)) | |
; | |
// Make WebP versions or PNG & JPG | |
gulp.src(source + '/**/*.{jpg,png}') | |
// Only new stuff | |
.pipe(newer(destination)) | |
// WebP | |
.pipe(webp()) | |
// Publish | |
.pipe(gulp.dest(destination)) | |
; | |
return true; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment