{"id":15659715,"url":"https://github.com/jakejarvis/netlify-plugin-cache","last_synced_at":"2025-04-28T16:04:09.473Z","repository":{"id":44899436,"uuid":"269991382","full_name":"jakejarvis/netlify-plugin-cache","owner":"jakejarvis","description":"⚡ Generic plugin for caching any files and/or folders between Netlify builds","archived":false,"fork":false,"pushed_at":"2022-11-23T07:53:55.000Z","size":4345,"stargazers_count":21,"open_issues_count":10,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-28T16:02:36.937Z","etag":null,"topics":["build","cache","ci","netlify","netlify-plugin","plugin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/netlify-plugin-cache","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jakejarvis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-06T13:34:54.000Z","updated_at":"2024-05-24T21:49:46.000Z","dependencies_parsed_at":"2022-09-03T05:00:45.123Z","dependency_job_id":null,"html_url":"https://github.com/jakejarvis/netlify-plugin-cache","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakejarvis%2Fnetlify-plugin-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakejarvis%2Fnetlify-plugin-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakejarvis%2Fnetlify-plugin-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakejarvis%2Fnetlify-plugin-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakejarvis","download_url":"https://codeload.github.com/jakejarvis/netlify-plugin-cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251342721,"owners_count":21574244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build","cache","ci","netlify","netlify-plugin","plugin"],"created_at":"2024-10-03T13:18:20.343Z","updated_at":"2025-04-28T16:04:09.159Z","avatar_url":"https://github.com/jakejarvis.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ⚡ Netlify Plugin: Custom Cache [![npm](https://img.shields.io/npm/v/netlify-plugin-cache?logo=npm\u0026color=red)](https://www.npmjs.com/package/netlify-plugin-cache) ![CI](https://github.com/jakejarvis/netlify-plugin-cache/workflows/CI/badge.svg)\n\nA 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! ⏰\n\nEssentially, this plugin is a pretty wrapper around [Netlify's native cache utility](https://github.com/netlify/build/blob/master/packages/cache-utils/README.md) — it isn't tied to any specific static site generator (on purpose).\n\n## 💿 Install\n\nAdd the following lines to your `netlify.toml`:\n\n```toml\n[[plugins]]\npackage = \"netlify-plugin-cache\"\n  [plugins.inputs]\n  # Optional (but highly recommended). Defaults to [\".cache\"].\n  paths = [\"resources\", \"_vendor\", \"folder/file.md\"]\n```\n\nThis 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**.\n\n**🚨 Important:** `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.\n\nRead more about plugin configuration at [the official Netlify Plugin docs](https://docs.netlify.com/configure-builds/build-plugins/#install-a-plugin).\n\n## 👩‍💻 Usage\n\n- **Hugo:** Caching the `resources` directory can speed up your build greatly if you [process](https://gohugo.io/content-management/image-processing/) a lot of images, or compile SASS/SCSS via Hugo pipes. You can also cache the `public` directory to avoid completely rebuilding the entire site on each deploy. [More info here.](https://gohugo.io/getting-started/directory-structure/#directory-structure-explained)\n- **Gatsby:** By default, the `.cache` directory holds persistent data between builds. You can also cache the `dist` directory to avoid completely rebuilding the entire site on each deploy. [More info here.](https://www.gatsbyjs.org/docs/build-caching/)\n- **Jekyll:** A caching API was added as of v4. The notoriously slow SSG can become (relatively) faster by caching the `.jekyll-cache` directory. [More info here.](https://jekyllrb.com/tutorials/cache-api/)\n- **Next.js:** The `.next` directory holds the build output. [More info here.](https://nextjs.org/docs/api-reference/next.config.js/setting-a-custom-build-directory)\n- **Anything else:** This is the reason I kept this plugin as generic as possible! Research the caching behavior of your static site generator (and how to customize it if necessary). Feel free to open a PR and list it here as well!\n\n## 🐛 Debugging\n\nThis 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`](https://github.com/netlify-labs/netlify-plugin-debug-cache) to do exactly that. No need to re-invent the wheel!\n\nYou can add the debug plugin **after** this plugin in your `netlify.toml`. (And yes, you need a `[[plugins]]` line for _each_ plugin you add.)\n\n```toml\n[[plugins]]\npackage = \"netlify-plugin-debug-cache\"\n```\n\nThe debug plugin will generate a file named `cache-output.json` at the root of your project's publish directory. [See an example file](https://infallible-wing-581e78.netlify.app/cache-output.json) or [learn more about this plugin](https://github.com/netlify-labs/netlify-plugin-debug-cache).\n\n## 📜 License\n\nThis project is distributed under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakejarvis%2Fnetlify-plugin-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakejarvis%2Fnetlify-plugin-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakejarvis%2Fnetlify-plugin-cache/lists"}