netlify-plugin-gridsome-cache
v1.0.3
Published
Persist the Gridsome cache between Netlify builds for huge build speed improvements!
Downloads
72
Readme
Netlify Build Plugin: Persist the Gridsome Cache Between Builds
Persist the Gridsome cache between Netlify builds for huge build speed improvements! ⚡️
What are Netlify build plugins? Check out the announcement page on Netlify.
One-click install to add this to your Gridsome site
Usage
If you don’t want to use the UI-based installation, you can install manually using netlify.toml
.
Add the following lines to your netlify.toml
file:
[build]
publish = "dist"
[[plugins]]
package = "netlify-plugin-gridsome-cache"
Note: The [[plugins]]
line is required for each plugin, even if you have other plugins in your netlify.toml
file already.
This plugin determines the location of your .cache
folder by looking at the publish
folder configured for Netlify deployment (this must be set in your netlify.toml
in the [build]
section). This means that if your Gridsome site successfully deploys, it will be cached as well with no config required! 🎉
How much of a difference does this plugin make in build times?
Each Gridsome site is different, so build times vary widely between them, but one common slowdown in Gridsome builds is processing and transforming images. Gridsome is smart enough to check if these transformations have already been done and skip them, but in order to get that benefit in a build pipeline (e.g. Netlify) the dist
and .cache
directories need to be preserved between builds. That’s what this plugin does!
| | No Cache | Cache | Savings | | ----------------------------------------------------- | -------- | ----- | ------- | | _ 231 GraphQL queries_ 295 images* 295 pages | 27.5s | 22.4s | 22% |
tl;dr: Repeat builds with lots of images will be much faster. With few or no images, the difference will be there, but it won’t be as pronounced.
*note: the above differences are cited from my blog's repo; if you would like to submit a PR to add additional application size/savings data, I will be happy to accept it
Want to learn how to create your own Netlify Build Plugins?
Check out Sarah Drasner’s excellent tutorial!
Credits
Thank you to @jlengstorf whose work this repo is forked from; jlengstorf/netlify-plugin-gatsby-cache.
License
MIT