For static sites, build times can get out of hand as you scale the size of your site and editing experience. Traditionally, the need for a static site to go through a full rebuild has been the bane of any developer or content creator. Working on a huge site, with thousands of pages, but just noticed a small typo on your “About Us” page? Well, get ready to make your changes in your CMS and then have your static site fully rebuild, sometimes taking several minutes to update. These slow build times have truly hampered marketing and content teams, giving larger teams pause when thinking about going static.
Incremental Builds is a feature of Gatsby that aims to make these content changes faster – dramatically faster.
With Gatsby, all the content and data of a website is held in our unique Data Layer, powered by GraphQL. This separation of content from the rest of the Gatsby build allows content to be updated on the fly without going through a full rebuild. That’s right – if you need to make a content change on your static site, Gatsby will only rebuild that exact file that was changed.
An Example Of Incremental Builds
Below is a full, warm build of the Gatsbyjs.com website. A warm build optimizes the build and caches as much as possible – so you can see the change still takes less than three and a half minutes.
Now, that’s not so bad for an entire change to our codebase from one of our engineers, but for a content author or marketer – this change can seem like an eternity.
Below is an example of a marketer on our team making a change in one of our CMSs, Contentful. With Incremental Builds, you can see the “Data” update happens in just a fraction of the time. This is because only the content that was changed in the CMS gets rebuilt on Gatsby Cloud, allowing authors to see their changes in near real-time.
Do Incremental Builds Work On Previews?
Yes, Incremental Builds will also happen on your CMS Preview Builds on Gatsby Cloud. When you draft and save content in your CMS, Gatsby Cloud will incrementally build that content just like it would when you hit publish, but it will only appear on your preview site. Below you can see Gatsby Cloud rebuilding content from several CMS’s incrementally:
How To Get Started With Incremental Cloud Builds
To get started building your site faster with Incremental Cloud Builds, just simply sign up for a Gatsby Cloud account and connect the CMS of your choice. You’ll find several of the most popular headless CMS’s, such as Contentful, WordPress, Dato, and Shopify have an integration, making connection simple and straightforward. Once connected, just click the CMS Preview tab on the right-hand side of your builds to see them in action!