Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andyrichardson/netlify-plugin-ttl-cache
A Netlify plugin for persisting immutable build assets across releases.
https://github.com/andyrichardson/netlify-plugin-ttl-cache
javascript netlify netlify-plugin
Last synced: 2 months ago
JSON representation
A Netlify plugin for persisting immutable build assets across releases.
- Host: GitHub
- URL: https://github.com/andyrichardson/netlify-plugin-ttl-cache
- Owner: andyrichardson
- Created: 2021-08-30T13:06:00.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-06-13T00:07:43.000Z (7 months ago)
- Last Synced: 2024-10-15T15:18:57.275Z (3 months ago)
- Topics: javascript, netlify, netlify-plugin
- Language: JavaScript
- Homepage:
- Size: 72.3 KB
- Stars: 15
- Watchers: 3
- Forks: 3
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Netlify plugin TTL cache
A Netlify plugin for persisting immutable build assets across releases.
## How it works
By default, Netlify replaces all existing static assets when publishing new releases.
For sites where assets are unique across deployments, and dynamically loaded (e.g. [`React.lazy`](https://reactjs.org/docs/code-splitting.html)) this can lead to runtime errors (e.g. [chunk-load errors](https://www.google.com/search?q=chunk+load+error+netlify&oq=chunk+load+error+netlify)).
This plugin prevents this problem by allowing users to include legacy assets across releases.
## Usage
Install the plugin
```sh
npm i -D netlify-plugin-ttl-cache
```Add the plugin to your `netlify.toml`
```toml
[[plugins]]
package = "netlify-plugin-ttl-cache"
[plugins.inputs]
path = "build"
ttl = 90
```## Inputs
### path
_Build output directory._
**type:** `string`
**default:** `"build"`
### ttl
_Maximum age (days) of files in cache._
**type:** `number`
**default:** `90`
### exclude
_Regular expression [string pattern](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) for files to exclude._
**type:** `string`
**default:** `n/a`