mahnunchik / gulp-responsive

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

Fix options passed to Sharp .toFormat() #117

Closed joranrood closed 5 years ago

joranrood commented 5 years ago

Trying to set the format option to "raw" or { "id": "raw" } yields the following error:

Message:
    File `portrait.png`: Unsupported output format function(filePath) {
  var extname = path.extname(filePath);
  switch (extname) {
    case '.jpeg':
    case '.jpg':
    case '.jpe':
      return 'jpeg';
    case '.png':
      return 'png';
    case '.webp':
      return 'webp';
    default:
      return 'unsupported';
  }
}

This is because the format function is passed to the Sharp .toBuffer() method instead of the actual format value. This PR fixes the issue.