-
-
Save jcicero518/c6692de3ab03082a68dd3cbad22436ab to your computer and use it in GitHub Desktop.
Gulp Images
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
'use strict'; | |
let config = require('../config'); | |
let gulp = require('gulp'); | |
let gulpif = require('gulp-if'); | |
let newer = require('gulp-newer'); | |
let imagemin = require('gulp-imagemin'); | |
let pngquant = require('imagemin-pngquant'); | |
let browserSync = require('browser-sync'); | |
gulp.task('images', function() { | |
gulp.src(config.images.src) | |
// Add the newer pipe to pass through newer images only | |
.pipe(newer(global.isProd ? config.images.prodDest : config.images.dest)) | |
.pipe(imagemin({ | |
progressive: true, | |
plugins: [pngquant({quality: '75-90'})] | |
})) | |
.pipe(gulp.dest(global.isProd ? config.images.prodDest : config.images.dest)) | |
.pipe(browserSync.stream({ once: true })); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment