DeMoorJasper / parcel-plugin-imagemin

Parcel image minification plugin
MIT License
129 stars 7 forks source link

Is it possible to add in plugin imagemin ability to transfrom images to .webP #96

Open Ihornechypor opened 3 years ago

Ihornechypor commented 3 years ago

Hi imagemin have good additional plugin for genereting webp images.

Is it possible to implement this ability to parcel-plugin-imagemin ?

Something like this ↓

`const ImageAsset = require('./ImageAsset');

// Imagemin const imagemin = require('imagemin'); const imageminMozjpeg = require('imagemin-mozjpeg'); const imageminWebp = require("imagemin-webp");

class JpgAsset extends ImageAsset { async packageImage(options, location) { const params = options && options.mozjpeg ? options.mozjpeg : { quality: 75 }; return imagemin([location], { plugins: [imageminMozjpeg(params), imageminWebp({quality: 75})] }); } }

module.exports = JpgAsset; `