npg
netlify-plugin-gridsome-cache
npm i netlify-plugin-gridsome-cache
npg

netlify-plugin-gridsome-cache

Persist the Gridsome cache between Netlify builds for huge build speed improvements!

by Eric McCormick

1.0.3 (see all)License:MITTypeScript:Not Found
npm i netlify-plugin-gridsome-cache
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 CacheCacheSavings
231 GraphQL queries
295 images
* 295 pages
27.5s22.4s22%

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

Downloads/wk

81

GitHub Stars

11

LAST COMMIT

2yrs ago

MAINTAINERS

1

CONTRIBUTORS

6

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
1.0.3
latest
2yrs ago
No alternatives found
No tutorials found
Add a tutorial