Skip to content
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

fix(gatsby-plugin-sharp): Fix defaults handling #29564

Merged
merged 2 commits into from
Feb 18, 2021
Merged

Conversation

ascorbic
Copy link
Contributor

The previous defaults handling didn't work with array values. This replaces the standard lodash defaultsDeep with a custom function that replaces rather than merges arrays. Added unit tests to verify.

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Feb 18, 2021
@ascorbic ascorbic added topic: media Related to gatsby-plugin-image, or general image/media processing topics and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Feb 18, 2021
Copy link
Contributor

@laurieontech laurieontech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question. but looks good otherwise!

## Options

- `defaults`: default values used for `gatsbyImageData` and `StaticImage` from [gatsby-plugin-image](https://www.gatsbyjs.com/plugins/gatsby-plugin-image).
Available options are: `formats`,`placeholder`,`quality`,`breakpoints`,`backgroundColor`,`tracedSVGOptions`,`blurredOptions`,`jpgOptions`,`pngOptions`,`webpOptions`,`avifOptions`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

layout?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it makes sense as something to be able to change defaults. I left out things that are very specific to individual images: dimensions, aspect ratio and layout

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...and transform options

@ascorbic ascorbic merged commit 107926a into master Feb 18, 2021
@ascorbic ascorbic deleted the fix/sharp-defaults branch February 18, 2021 16:18
ascorbic added a commit that referenced this pull request Feb 19, 2021
Co-authored-by: gatsbybot <mathews.kyle+gatsbybot@gmail.com>
(cherry picked from commit 107926a)
ascorbic added a commit that referenced this pull request Feb 22, 2021
Co-authored-by: gatsbybot <mathews.kyle+gatsbybot@gmail.com>
(cherry picked from commit 107926a)
@ascorbic
Copy link
Contributor Author

Published in gatsby-plugin-sharp@2.14.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: media Related to gatsby-plugin-image, or general image/media processing topics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants