image-minimizer-webpack-plugin
image-minimizer-webpack-plugin copied to clipboard
Documentation: Typo in the squoosh-generator-resize section
Documentation Is:
- [ ] Missing
- [ ] Needed
- [x] Confusing
- [ ] Not Sure?
Please Explain in Detail...
The documentation for the resize option of the squoosh generator has a typo:
const ImageMinimizerPlugin = require("image-minimizer-webpack-plugin");
module.exports = {
optimization: {
minimizer: [
"...",
new ImageMinimizerPlugin({
generator: [
{
// You can apply generator using `?as=webp-100-50`, you can use any name and provide more options
preset: "webp-100-50",
implementation: ImageMinimizerPlugin.squooshGenerate,
options: {
encodeOptions: {
resize: {
enabled: true,
width: 100,
height: 50,
},
webp: {
quality: 90,
},
},
},
},
],
}),
],
},
};
Your Proposal for Changes
Notice that the resize option is inside the encodeOptions, but it should actually say:
const ImageMinimizerPlugin = require("image-minimizer-webpack-plugin");
module.exports = {
optimization: {
minimizer: [
"...",
new ImageMinimizerPlugin({
generator: [
{
// You can apply generator using `?as=webp-100-50`, you can use any name and provide more options
preset: "webp-100-50",
implementation: ImageMinimizerPlugin.squooshGenerate,
options: {
resize: {
enabled: true,
width: 100,
height: 50,
},
encodeOptions: {
webp: {
quality: 90,
},
},
},
},
],
}),
],
},
};
because utils.js takes the preprocess options for libsquoosh directly from squooshOptions (minifyOptions) and not from squooshOptions.encodeOptions
PR welcome
maybe a good first issue?