-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby-plugin-sharp): Add image plugin defaults #29147
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question I have with this is whether it's more intuitive to pass these defaults to gatsby-plugin-image and let them pass on to sharp. I know that's not the plugin in charge of processing, but I expect that's how users will think about it?
@@ -215,4 +215,26 @@ exports.pluginOptionsSchema = ({ Joi }) => | |||
stripMetadata: Joi.boolean().default(true), | |||
defaultQuality: Joi.number().default(50), | |||
failOnError: Joi.boolean().default(true), | |||
defaults: Joi.object({ | |||
formats: Joi.array().items( | |||
Joi.string().valid(`auto`, `png`, `jpg`, `webp`, `avif`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is jpeg valid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No
pngOptions: Joi.object(), | ||
webpOptions: Joi.object(), | ||
avifOptions: Joi.object(), | ||
}).description( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transformOptions? Any of the sizing stuff like aspectRatio?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the sizing options make sense to have as global defaults. I guess transformOptions could though. I'll add them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, my one thought was aspectRatio could, since it's more look and feel that strict sizing. But no strong feelings on that one.
Adds support for users to specify default values for most gatsby-plugin-image options. These are set on gatsby-plugin-sharp, in the
defaults
key.e.g.
[ch23484]