mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-04 10:06:37 -04:00
restore appropriate cache plugin settings [skip ci]
This commit is contained in:
@ -40,8 +40,8 @@
|
||||
# Cache resoures between builds, see plugins/netlify-plugin-cache/index.js
|
||||
[[plugins]]
|
||||
package = "./plugins/netlify-plugin-cache"
|
||||
# [plugins.inputs]
|
||||
# paths = ["resources", "_vendor"]
|
||||
[plugins.inputs]
|
||||
paths = ["resources", "_vendor"]
|
||||
[[plugins]]
|
||||
package = "netlify-plugin-debug-cache"
|
||||
|
||||
|
@ -51,7 +51,7 @@
|
||||
"imagemin-svgo": "^8.0.0",
|
||||
"lint-staged": "^10.2.9",
|
||||
"markdownlint-cli": "~0.23.1",
|
||||
"netlify-plugin-cache": "^1.0.0",
|
||||
"netlify-plugin-cache": "^1.0.1",
|
||||
"netlify-plugin-debug-cache": "^1.0.3",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"postcss": "^7.x",
|
||||
|
21
plugins/netlify-plugin-cache/LICENSE
Normal file
21
plugins/netlify-plugin-cache/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Jake Jarvis
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
49
plugins/netlify-plugin-cache/README.md
Normal file
49
plugins/netlify-plugin-cache/README.md
Normal file
@ -0,0 +1,49 @@
|
||||
# Netlify Plugin: Custom Cache
|
||||
|
||||
[](https://www.npmjs.com/package/netlify-plugin-cache)
|
||||
|
||||
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! ⚡
|
||||
|
||||
In other words, 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).
|
||||
|
||||
## Install
|
||||
|
||||
Add the following to your `netlify.toml` configuration:
|
||||
|
||||
```toml
|
||||
[[plugins]]
|
||||
package = "netlify-plugin-cache"
|
||||
[plugins.inputs]
|
||||
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**.
|
||||
|
||||
**🚨 Important:** `paths` defaults to `[".cache"]`, but it's **highly recommended** you set this yourself based on the tools you're using. See examples below.
|
||||
|
||||
Read more about plugin configuration at [the official Netlify Plugin docs](https://docs.netlify.com/configure-builds/build-plugins/#install-a-plugin).
|
||||
|
||||
## Usage examples
|
||||
|
||||
- **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 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)
|
||||
- **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/)
|
||||
- **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)
|
||||
- **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 make a PR and add it here as another example, too!
|
||||
|
||||
## Debugging
|
||||
|
||||
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`](https://github.com/netlify-labs/netlify-plugin-debug-cache) to do exactly that. No need to re-invent the wheel!
|
||||
|
||||
You can add their debug plugin **after** this plugin in your `netlify.toml`. (And yes, you need a `[[plugins]]` line for *each* plugin you add.)
|
||||
|
||||
```toml
|
||||
[[plugins]]
|
||||
package = "netlify-plugin-debug-cache"
|
||||
```
|
||||
|
||||
The plugin will generate a file named `cache-output.json` at the root of your project's publish directory. [See an example file](https://gist.github.com/jakejarvis/dff606289e8b5d6be42d317e425bbee6#file-cache-output-json) or [learn more about this plugin](https://github.com/netlify-labs/netlify-plugin-debug-cache).
|
||||
|
||||
## Licenses
|
||||
|
||||
This project is distributed under the [MIT License](LICENSE).
|
25
plugins/netlify-plugin-cache/package.json
Normal file
25
plugins/netlify-plugin-cache/package.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "netlify-plugin-cache",
|
||||
"version": "1.0.1",
|
||||
"description": "Generic cache plugin for saving and restoring files and/or folders between Netlify builds",
|
||||
"author": "Jake Jarvis <jake@jarv.is>",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"homepage": "https://github.com/jakejarvis/netlify-plugin-cache#readme",
|
||||
"bugs": "https://github.com/jakejarvis/netlify-plugin-cache/issues",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jakejarvis/netlify-plugin-cache.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [
|
||||
"netlify",
|
||||
"netlify-plugin",
|
||||
"cache",
|
||||
"ci",
|
||||
"build",
|
||||
"plugin"
|
||||
]
|
||||
}
|
@ -3094,10 +3094,10 @@ natural-compare@^1.4.0:
|
||||
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
|
||||
integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=
|
||||
|
||||
netlify-plugin-cache@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/netlify-plugin-cache/-/netlify-plugin-cache-1.0.0.tgz#f5612c3c46b81ea4a1906c86335d6760eea28048"
|
||||
integrity sha512-rF2lcLH30OGsnFv4jSAt4iD4M0qfknv/3LjTb0OAigNylb4IAK9slrGAZhmK0Cn0AXftzh+4xCiOQ1TfpQb01w==
|
||||
netlify-plugin-cache@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/netlify-plugin-cache/-/netlify-plugin-cache-1.0.1.tgz#65c7a722938d973b9c56202d2dcbbd3d187b8d2c"
|
||||
integrity sha512-IAHI0K5lp/PP35UaOWjRRsFFWMiHphiTFlFGHj2Vt0r9a9qwxT54PxJqFCunxKtPxynQ3E7/Ybi2cwLd4lbb/g==
|
||||
|
||||
netlify-plugin-debug-cache@^1.0.3:
|
||||
version "1.0.3"
|
||||
|
Reference in New Issue
Block a user