mahnunchik / gulp-responsive

gulp-responsive generates images at different sizes
https://npmjs.com/gulp-responsive
MIT License
503 stars 60 forks source link

jpeg -> jpg #118

Closed Alexufo closed 5 years ago

Alexufo commented 5 years ago

extname: '.jpg' always return 'jpeg' in file name. How I can disable it?

idiazroncero commented 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:

s8m2s commented 5 years ago

same issue here

artlili commented 5 years ago

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/'));
  });
s1awek commented 5 years ago

Just add format: 'jpg', eg.: { width: '50%', format: 'jpg', }

StarpTech commented 5 years ago

Fixed in https://github.com/mahnunchik/gulp-responsive/pull/129