v2.32 (February 2021 #1)
firstname.lastname@example.org release (February 2021 #1)
Key highlights of this release:
- Stable API in beta image plugin
- Support for beta image plugin in Contentful
- Default sharp settings in beta image plugin
- Support for art direction in beta image plugin
- Performance improvements for larger sites (10000+ pages)
Also check out notable bugfixes.
Bleeding Edge: Want to try new features as soon as possible? Install
gatsby@next and let us know
if you have any issues.
With this release, the API for gatsby-plugin-image can be considered stable. We do not expect any breaking changes to be made before general release, upcoming work will focus on bugfixes and minor updates. You can start to migrate your sites to use the new plugin, and benefit from the improved performance, new components, and cleaner API.
This release includes initial support for the beta image plugin in
gatsby-source-contentful. This adds a new
gatsbyImageData resolver to ContentfulAsset nodes, allowing you to use the new image components with your Contentful data. This is a first release and does not yet have proper documentation, but please try it out and report back in the gatsby-plugin-image RFC.
Do you always want to generate AVIF images? Should your hero image breakpoints support 8K monitors? Until now you needed to pass the relevant options for every image. This release adds support for default options, meaning you can set most options once in gatsby-config and they will apply by default to both dynamic and static images. Add a
defaults object to your
gatsby-plugin-sharp config, and pass it any valid option. Note that sizing options, e.g. width and height, are not supported as they’re image specific.
Art direction is a browser feature that allows you to specify different images to be displayed at different screen sizes. This is different from responsive images, which provides different image resolutions. Until now this feature has been missing in the new image plugin, but this release adds a new
useArtDirection hook, which allows you to art direct your images. It does not have full docs, but see the PR for more information and a video featuring a pug in a raincoat.
We landed two PRs that improve build performance for larger sites.
On our minimal benchmark site, these improved build times by ~15% for a 10,000 page site and 30% for a 100,000 page site!
- gatsby-plugin-sharp: The
failOnErroris correctly passed to sharp, allowing the build to proceed when there are corrupt images, via PR #29254
- gatsby-plugin-sharp: Fixes a bug that caused build failures on Windows when generating traced SVGs, via PR #29246
- gatsby-plugin-manifest: Fixes to plugin options validation, via PR #29242 and PR 29193
- gatsby-source-contentful: Correctly handle env-specific API key validation, via PR 29228
- babel-plugin-remove-graphql-queries: Make sure imports are POSIX-compliant, via PR #29144
A big Thank You to our community who contributed to this release 💜