|Jake Jarvis 29cf08d5ff||7 months ago|
|.github/workflows||7 months ago|
|example||7 months ago|
|.gitignore||7 months ago|
|.npmignore||7 months ago|
|.npmrc||7 months ago|
|LICENSE||7 months ago|
|README.md||7 months ago|
|index.js||7 months ago|
|manifest.yml||7 months ago|
|package.json||7 months ago|
A generic cache plugin for saving and restoring files and/or folders between Netlify builds for impressive speed improvements. Worry less about running out of build minutes! ⏰
Essentially, this plugin is a pretty wrapper around Netlify's native cache utility — it isn't tied to any specific static site generator (on purpose).
Add the following lines to your
[[plugins]] package = "netlify-plugin-cache" [plugins.inputs] # Optional (but highly recommended). Defaults to [".cache"]. paths = ["resources", "_vendor", "folder/file.md"]
This plugin only takes one input named
paths: an array of files and/or directories relative to your project's root. These files/directories are restored before a build and saved in cache after a build if it is successful.
paths defaults to
[".cache"], but it's highly recommended you set this yourself based on the tool(s) you're using to generate your site. See examples below.
Read more about plugin configuration at the official Netlify Plugin docs.
resourcesdirectory can speed up your build greatly if you process a lot of images, or compile SASS/SCSS via Hugo pipes. You can also cache the
publicdirectory to avoid completely rebuilding the entire site on each deploy. More info here.
.cachedirectory holds persistent data between builds. You can also cache the
distdirectory to avoid completely rebuilding the entire site on each deploy. More info here.
.jekyll-cachedirectory. More info here.
.nextdirectory holds the build output. More info here.
This plugin doesn't provide a way to output a list of files that were cached or restored, because Netlify already provides an official plugin named
netlify-plugin-debug-cache to do exactly that. No need to re-invent the wheel!
You can add the debug plugin after this plugin in your
netlify.toml. (And yes, you need a
[[plugins]] line for each plugin you add.)
[[plugins]] package = "netlify-plugin-debug-cache"
This project is distributed under the MIT license.