Skip to content

Instantly share code, notes, and snippets.

@aarongustafson aarongustafson/images.js
Last active Sep 21, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.