Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug if he doesn't found a file #57

Closed
qlaffont opened this issue Oct 25, 2016 · 5 comments
Closed

Bug if he doesn't found a file #57

qlaffont opened this issue Oct 25, 2016 · 5 comments
Assignees

Comments

@qlaffont
Copy link

qlaffont commented Oct 25, 2016

Hi,
I have a simple task but gulp bug when he doesn't found any file with .png :

gulp.task('tasks0', ['task'],  function(){

  return gulp.src('app/assets/img/upload/other/*.{png,jpg,jpeg}')
  .pipe(responsive({
      // produce multiple images from one source
      '*.jpg':
        {
          width: 720,
          withoutEnlargement:false,
          progressive: true,
          quality:70
        },
      '*.png':
        {
          width: 720,
          progressive:true,
          compressionLevel : 7,
          withoutEnlargement:true
        },
      '*':
      {
        width: 720,
        progressive:true,
        withoutEnlargement:false
      }
    }))
  .pipe(gulp.dest('app/assets/img/upload/other/'));
}
); 

Regards
Quentin

@mahnunchik mahnunchik self-assigned this Oct 26, 2016
@mikemcguire
Copy link

This issues is really vague. But one of the devs on my team added this plugin to our build process. Unfortunately it breaks when there are no images to be processed. This plugin runs on our watch tasks and when we first start a project we won't have images to be processed. But we still need our JS & Postcss to be processed. I've tried playing with the error & silent configuration options with no effect.

Error: Available images do not match the following config:
  - `*`

@mahnunchik
Copy link
Owner

Hi @qlaffont @mikemcguire

It seems errorOnUnusedConfig option should solve the problem. https://github.com/mahnunchik/gulp-responsive#erroronunusedconfig

@lstanard
Copy link

@mahnunchik - I tried both the errorOnUnusedConfig and silent options but neither seemed to fix the issue.

I ended up adding an error handler and that at least catches the error so it doesn't kill the process completely.

return gulp.src(SRC)
        .pipe(responsive({
            '*': {
                width: '50%',
                height: '50%',
            }
        }).on('error', function (err) {
            gutil.log('No matching images found in source: ' + SRC, '');
        }))
        .pipe(rename(function (path) {
            path.basename = path.basename.replace(/(@2x)/g, '');
        }))
        .pipe(gulp.dest(DEST));

@mahnunchik
Copy link
Owner

Hi @lstanard

You may try another options: https://github.com/mahnunchik/gulp-responsive#options

@danisztls
Copy link

The options 'errorOnUnusedImage: false' and 'silent: true' are not a solution. The bug persist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants