Closed Alexufo closed 5 years ago
I had the same issue and solved it by manually patching this project.
I used patch-package, and it's as easy as this:
yarn add patch-package postinstall-postinstall
."postinstall": "patch-package",
to your package.json scripts./node_modules/gulp-responsive/lib/format.js
and modify line 11 to return 'jpg'
instead of jpeg
yarn patch-package gulp-responsive
. This will automagically generate a patch with your changes.node_modules
and it affects gulp-responsive, the patch will be applied to ensure everything keeps working as intended. This is because postinstall
script runs automatically every time a new install happens.yarn postinstall
.same issue here
I used gulp-if and gulp-rename
global.$ = {
gp: require('gulp-load-plugins')();
}
$.gulp.task('responsive', () => {
return $.gulp.src('./dev/static/images/**/*.{jpg,png,webp}')
.pipe($.gp.responsive({
'**/*': [{
width: '50%',
},
{
width: '100%',
rename: { suffix: '@2x' },
}]
}, {
quality: 70,
progressive: true,
withMetadata: false,
errorOnEnlargement: false,
}))
.pipe($.gp.if(file => {
return file.path.match('.jpeg') },
$.gp.rename({extname: ".jpg"
})))
.pipe($.gulp.dest('./build/images/'));
});
Just add format: 'jpg'
, eg.:
{ width: '50%', format: 'jpg', }
extname: '.jpg' always return 'jpeg' in file name. How I can disable it?