When considering build times in Gatsby, there are three types of builds to keep in mind:
- Full Builds
- Incremental Builds
- Cloud Builds
Full Builds
A full build is a traditional Gatsby build that rebuilds your entire static site. These take place on an initial deployment to Gatsby Cloud and on any manual rebuilds.
Incremental Builds
An incremental build is a build of Gatsby that generates only the subset of HTML files that needed to be updated based on the changes made to the site. Changes to page templates, page queries, static queries, and frontend source code cause HTML files to be marked for regeneration.
With the release of Gatsby V3, Incremental Builds are now part of the core, framework builds of Gatsby. This means that almost all builds in Gatsby Cloud will be incremental builds, building only the files that you have changed.
This is an improvement on the GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES
feature that was introduced in version 2 of Gatsby. We improved it, made it stable, and activated it by default for everyone! So incremental builds is available in OSS now. This improvement is (re)generating only subset of HTML files that needs to be generated. To be able to use it you will need to keep .cache
and public
directories from previous builds.
See the release notes for more info on how it works.
Cloud Builds
Cloud build have two main features:
- Parallelized image processing
- Fast content / data updates
Parallelized image processing
Gatsby Cloud streamlines heavy work from the Gatsby build process by parallelizing it across multiple processes. This leads to a dramatic reduction in build times. If your site is using gatsby
version 2.19.5 or later and gatsby-plugin-sharp
version 2.4.0 or later, this feature is already working for your site.
Fast Content / Data Updates
Gatsby Cloud also uses intelligent caching to determine which parts of your site need an update and then it only updates those parts. This works only with data changes coming from supported content management systems, not code changes.
A data change is any change to content sourced from a content management system (CMS) connected to your site, e.g. Contentful, WordPress, etc. Things like correcting a typo in a post or swapping an image file will trigger a cloud build.
Enabling Cloud Builds
Cloud Builds are only available for paid plans and trials. Your site must also be using gatsby
version 2.20.4 or later, but we recommend running the latest Gatsby for the fastest builds. You can enable them on a per site basis via Site Settings.
You can identify a Cloud Build from the "Cloud" badge on the build card.
Comments
0 comments
Please sign in to leave a comment.