Netlify Plugin: Enable Gatsby Incremental Builds In My Blog
Received an email from Netlify last week, said Gatsby.js released something called incremental builds. It help to reduce the amount of work required to build a Gatsby.js site.
Based on my understanding, it’s something like when I push my website’s update to Netlify. Instead of rebuilding the entire site, Netlify will just update the part I make a change. Significantly decrease the Netlify build time especially for a large site.
The more you use Netlify’s build time, the more you need to pay. First 300 minutes of build time is FREE, Next 500 minutes is US 7.
I not sure why Netlify does this. Enable user to reduce the build time with plugin mean Netlify gain less income. If Netlify aware of this and still provide this kind of plugin to increase user experience, it’s a buddha’s heart enterprise. Thank you Netlify
Enough talk, let’s dig the guide!
Must be latest than v2.20.4. By the time you read this, Gatsby.js surely latest than the required version. In case you want to check out the version of Gatsby.js:-
npm list gatsby
The time I run this command, my Gatsby.js version is v2.20.36
I log in to my Netlify account, at the upper right-hand corner. Click Build Plugins
Then click Enable the beta
Choose the site you want to enable the build plugins.
I don’t see my blog is listed. I not sure why. Do you know what going on? Feel free to reach me out at Twitter
No choice, I have to choose my company website to try out the plugin. The file size is also bigger than my blog. Good for trying out incremental build plugin.
By looking at the guide, it mentioned something called netlify.toml
Is this file in Netlify site or in my gatsby.js project?
digging… finding… searching…
A few moments later time again
I think I should google it before trying to find it out myself.
Ops, forgive me. I’m a real noob.
I add netlify.toml in my gatsby’s project root directory
Copy and paste the following code to the file
[[plugins]]package = "netlify-plugin-gatsby-cache"
Go to package.json
Replace the build script with
"build": "GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --log-pages"
According to the guide, adding —log-pages can see what Gatsby builds on each run
Ok, the exciting time is coming. Time to try incremental builds. Yohoo~~~
Push the new update and wait for Netlify to build.
Ops~ si~ My bad, this is the first time I setup this Builds Plugin.
No result is shown for the first time.
Will update this blog when I get the result