-
Notifications
You must be signed in to change notification settings - Fork 0
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
How to disable some output formats? #56
Comments
Thanks for the question @biosocket, I'm glad that this project is useful for you :) I tried to make this plugin as thin a layer as possible between gulp and libSquoosh, configuration object is completely the same and is passed as is. Just like in libSquoosh, you can transform a single file into several formats at once: gulpSquoosh({
encodeOptions: {
jxl: {},
avif: {},
},
}); The result of this configuration will be 2 files (for each input file) Most codecs in libSquoosh change the image format ( If we have gulpSquoosh(({ filePath }) => {
const imageExtension = path.extname(filePath);
const isPng = imageExtension === ".png";
const optionsForPng = { oxipng: {} };
const optionsForJpg = { mozjpeg: {} };
const options = isPng ? optionsForPng : optionsForJpg;
return {
encodeOptions: options,
};
}); Here we pass function that will be called for each input image, and we check whether it Thus, we can have a different configuration for each image. If you run plugin without any configuration |
Thank you so much for the detailed reply. |
Your example worked perfectly. |
Thanks for this awesome project :)
How do you disable some output formats? When I run the examples, each image is converted into every output format. How do you, for example, only output JPG? Or similarly, output each image only in its original format. For example, if a JPG and and PNG are processed, the output is a JPG and a PNG, corresponding to the input.
Thanks
The text was updated successfully, but these errors were encountered: