Open Ihornechypor opened 1 year ago
Hello, maybe someone has an issue with image optimization. I've tried different parameters but still have the same result. And after conversion tinypng can optimize images with -70% result.
`const { src, dest, parallel, series, } = require('gulp');
const responsive = require("gulp-responsive"); const clean = require('gulp-clean');
const delDist = () => src('dist/*/', {read: false}).pipe(clean())
const respImages = () => { return src('src//*.{jpg,png}') .pipe( responsive({ '*/.jpg': [{ width: "5%", blur: 1.2, quality: 50, rename: { suffix: '-ph' }, format: ['webp'] }, { width: "100%", quality: 50, rename: { suffix: '@2x' }, format: ['webp', 'jpg'] }, { width: "50%", quality: 50, quality: 75, format: ['webp', 'jpg'] }], '/*.png': [{ width: "5%", quality: 50, blur: 1.2, rename: { suffix: '-ph' }, format: ['webp'] }, { width: "100%", quality: 50, rename: { suffix: '@2x' }, format: ['webp', 'png'] }, { width: "50%", quality: 50, format: ['webp', 'png'] }] }, { errorOnEnlargement: false, skipOnEnlargement: true, errorOnUnusedConfig: false, errorOnUnusedImage: false }) ) .pipe(dest('dist')); };
exports.default = series(delDist, parallel(respImages)); `
Hello, maybe someone has an issue with image optimization. I've tried different parameters but still have the same result. And after conversion tinypng can optimize images with -70% result.
`const { src, dest, parallel, series, } = require('gulp');
const responsive = require("gulp-responsive"); const clean = require('gulp-clean');
const delDist = () => src('dist/*/', {read: false}).pipe(clean())
const respImages = () => { return src('src//*.{jpg,png}') .pipe( responsive({ '*/.jpg': [{ width: "5%", blur: 1.2, quality: 50, rename: { suffix: '-ph' }, format: ['webp'] }, { width: "100%", quality: 50, rename: { suffix: '@2x' }, format: ['webp', 'jpg'] }, { width: "50%", quality: 50, quality: 75, format: ['webp', 'jpg'] }], '/*.png': [{ width: "5%", quality: 50, blur: 1.2, rename: { suffix: '-ph' }, format: ['webp'] }, { width: "100%", quality: 50, rename: { suffix: '@2x' }, format: ['webp', 'png'] }, { width: "50%", quality: 50, format: ['webp', 'png'] }] }, { errorOnEnlargement: false, skipOnEnlargement: true, errorOnUnusedConfig: false, errorOnUnusedImage: false }) ) .pipe(dest('dist')); };
exports.default = series(delDist, parallel(respImages)); `