sindresorhus / gulp-imagemin

Minify PNG, JPEG, GIF and SVG images
MIT License
1.9k stars 156 forks source link

Some jpg images processed but not returned to gulp and missing in dist #212

Closed DanielaValero closed 8 years ago

DanielaValero commented 8 years ago

Hello everyone,

We have got in our project a weird but. We have a group of jpg images, all of them are processed and return the output in the verbose option, but 3 of them fail to be returned to the gulp pipe, and do not end in the dist folder.

edit: I did some tests, by commenting out this line: imageminJpegtran(), still the problem was there. So is not related to the optimization of the jpgs, but somehow related to how imagemin retrieved the file perhaps?

At least I can say that in the resolved promise the files are there, they are just missing to be copied in the output

Our config of imagemin is:

gulp.src([
    `${paths.src}/core/images/*.{png,jpeg,jpg}`,
    `${paths.src}/core/images/**/*.{png,jpeg,jpg}`,
  ])
    .pipe($.imagemin({
      progressive: true,
      interlaced: true,
      verbose: true,
    }))
    .pipe(gulp.dest('dist/images'))

  // Display the size of the images
  .pipe($.size({
    title: 'images',
  }));

Here you will see the group of files mentioned before:

group-of-original-files processed-files

Do you guys have any idea of what might be the cause of this issue? Do you need extra information ?

DanielaValero commented 8 years ago

Update:

We did more tests and realized, that for some of our team members, only 48 images are processed, for others 56, and that these are always taken by alphabetical order. This makes me think that is somehow related to gulp and how it handles the pipes?

strarsis commented 8 years ago

I have a similar issue where currently nothing seems to be passed through to dest.

DanielaValero commented 8 years ago

We realized that in our implementation, the location of the sizes was the problem, changing the order fixed the issue, now we have:

gulp.src([
    `${paths.src}/core/images/*.{png,jpeg,jpg}`,
    `${paths.src}/core/images/**/*.{png,jpeg,jpg}`,
  ])
    .pipe($.imagemin({
      progressive: true,
      interlaced: true,
      verbose: true,
    }))
  // Display the size of the images
  .pipe($.size({
    title: 'images',
  }))
  .pipe(gulp.dest('dist/images'));