Created
October 22, 2018 09:11
-
-
Save ihorduchenko/2e796bcd004200f4668cfb38fbbf07a8 to your computer and use it in GitHub Desktop.
Gulpfile for minifying images using gulp and gulp-image NPM packages
This file contains hidden or 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
const gulp = require('gulp'), | |
image = require('gulp-image'); | |
const src = './uploads/**/*.{jpg,JPG,jpeg,JPEG,png,svg,gif}', | |
dist = './uploads-min/'; | |
gulp.task('image', function () { | |
gulp.src(src) | |
.pipe(image({ | |
pngquant: true, | |
optipng: false, | |
zopflipng: true, | |
jpegRecompress: false, | |
mozjpeg: true, | |
guetzli: false, | |
gifsicle: true, | |
svgo: true, | |
concurrent: 10, | |
quiet: true // defaults to false | |
})) | |
.pipe(gulp.dest(dist)) | |
}); |
This file contains hidden or 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
{ | |
"name": "images", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"gulp": "^3.9.1", | |
"gulp-image": "^4.3.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment