v2.26 Release Notes
Welcome to gatsby@2.26.0
release (November 2020).
Key highlights of this release:
- New Image Plugin (beta) - access static images without GraphQL, high Lighthouse scores again
- File System Route API - create routes from your data using filename conventions
- New Release Process - more stability and clarity around Gatsby releases
gatsby-source-contentful
v4.0 - new RichText implementation, performance improvements
Other notable changes:
gatsby-plugin-mdx
- performance improvements- Enable compression in the dev server - speeds up remote previews
Sneak peek to next releases:
- Queries on Demand - improves
gatsby develop
bootup time - Experimental: Lazy images in develop
- Documentation Reorganization
Bleeding Edge: Want to try new features as soon as possible? Install gatsby@next
and let us know
if you have any issues.
New Release Process
We are evaluating a new process that should bring more stability and clarity to Gatsby releases.
File System Route API
This new API enables you to create routes from your GraphQL data using filename conventions, e.g. to create individual blog post pages for your blog. It also allows for creating client-only routes more easily.
Some examples:
src/pages/products/{Product.name}.js
will generate pages for all products with a path like/products/burger
src/pages/products/{Product.fields__sku}.js
will generate pages for all products with a path like/products/001923
src/pages/users/[id].js
will generate a route like/users/:id
src/pages/image/[...].js
will generate a route like/image/*
See full documentation, examples and related PR #27424.
Enable compression in the dev server
This lowers the amount of data transferred for one site especially in remote situations.
Most of that drop was from the commons.js
bundle.
See PR #27948 for details.
gatsby-plugin-image@0.1.0
(beta)
New image plugin to replace gatsby-image
, which greatly improves performance (Lighthouse 💯 again) and adds easy static images (no GraphQL). Part of it is also a new, simpler API for gatsby-transformer-sharp
.
StaticImage
This component is a new, simpler way to use Gatsby’s image processing for static images without needing to write GraphQL queries:
GatsbyImage
This is a complete rewrite of the Gatsby Image component, using native lazy loading whenever possible. In our tests it allows sites whose Lighthouse scores dropped in recent updates to get back to 100s across the board.
Simpler GraphQL for non-static images
Instead of having to remember lots of different fragments for different image types, you can pass all your options as field arguments (and get inline help in GraphiQL):
You then use the data like this:
gatsby-source-contentful@4.0.0
New Rich Text Implementation
Breaking Change: New rich text implementation for performance and usability. This is only a breaking change if you rely on the Rich Text Contentful field type.
See PR #25249 description for details and migration guide.
Performance improvements
The max of pageLimit
option was raised from 100
to 1000
(on Contentful’s side) which should lead
to significant reduction of remote fetching times.
Note that the default value for the pageLimit
option is still 100
, so you need to change
it manually in your site config to see performance improvements.
Due to technical limitations, the response payload size is still bound by a hard chunk download size, so it is possible you may need to use a lower value for your particular site.
gatsby-plugin-mdx@1.4.0
There was a significant performance improvement by making a certain node fetching step lazy. This is especially noticeable at scale. See PR #27937 for details.
Work in progress
Queries on Demand
When developing a Gatsby site there’s no need to run all graphql queries before serving the site. Instead, Gatsby could run queries for pages as they’re requested by a browser. This would avoid having to wait for slower queries (like image processing) if you’re editing an unrelated part of a site.
Try early alpha (and let us know if you have any issues with it):
Enable in your gatsby-config.js
:
Experimental: Lazy images in develop
We’ve got some feedback that the more image-heavy your website gets, the slower gatsby develop
.
This experimental version of gatsby-plugin-sharp
only does image processing when the page gets requested.
Try early alpha (and let us know if you have any issues with it):
Lazy images are enabled by-default in this version.
Documentation Reorganization
We’ve heard repeatedly from the community that Gatsby is a powerful tool, but it has a steep learning curve. We want to make it easier to get started with Gatsby. And that means having documentation that helps y’all find the information you need when you need it.
Contributors
A big Thank You to our community who contributed to this release 💜
- muescha
- MichaelDeBoey: chore(gatsby-plugin-cxs): Add pluginOptionsSchema validation PR #27600
- davad: fix(docs): Update documentation for createPages PR #27735
- me4502: fix(gatsby-plugin-sitemap): fixed missing sitemapSize config entry PR #27866
- axe312ger
- Refactor Rich Text implementation in gatsby-source-contentful PR #25249
- ARKEOLOGIST: fix(gatsby-plugin-google-tagmanager): allow functions for defaultDataLayer option PR #27886
- hoobdeebla: fix(renovate): move express-graphql and react-reconciler from minor to major update groups PR #27101
- StephanWeinhold: chore(docs): Add required
path
import to modifying-pages doc PR #27883 - ervasive: fix(gatsby): Update TS types to allow Node ‘parent’ to be nullable PR #26570
- manavm1990: chore(docs): Add children to styled-components doc PR #27011
- kadhirash: fix(docs): dictionary.txt -> KintoBlock-kintoblock PR #27580
- jerrydevs: fix(gatsby-transformer-asciidoc): fails when doc doesn’t have title PR #27865