@@ -5,7 +5,7 @@ A plugin to make building with Eleventy and Netlify a joy!
55### Speed up your builds ⚡
66- Caches images generated by [ @11ty/eleventy-img ] ( https://github.com/11ty/eleventy-img ) across builds
77- Caches assets fetched by [ @11ty/eleventy-cache-assets ] ( https://github.com/11ty/eleventy-cache-assets ) across builds
8- - Caches any other folders your choice (optional)
8+ - Caches any other folders of your choice (optional)
99
1010## Install
1111
@@ -52,7 +52,7 @@ The following `inputs` options are available:
5252directory)
5353
5454The folder(s) in which files generated by ` @11ty/eleventy-img ` are stored,
55- relative to publish directory. Can be a string or an array of strings .
55+ relative to the publish directory. Can be a String or an array of Strings .
5656
5757If set to ` false ` , files generated by ` @11ty/eleventy-img ` are not saved in
5858Netlify cache.
@@ -65,8 +65,9 @@ Netlify cache.
6565If set to ` true ` , a files generated by ` @11ty/eleventy-img ` will be served with
6666http header ` cache-control: public, max-age=31536000, immutable ` .
6767
68- This should be safe to do as the file names have a hash calculated using file
69- content and Sharp Options.
68+ Files generated by eleventy_img have a hash calculated using file content and
69+ [ Sharp plugin options] ( https://www.11ty.dev/docs/plugins/image/#advanced-control-of-sharp-image-processor )
70+ in their name, so you can cache them indefinitely.
7071
7172### ` cache_assets `
7273
@@ -75,8 +76,8 @@ content and Sharp Options.
7576publish directory)
7677
7778The folder(s) in which remote assets fetched by ` @11ty/eleventy-cache-assets `
78- are cached, relative to publish directory. Can be a string or an array of
79- strings .
79+ are cached, relative to publish directory. Can be a String or an array of
80+ Strings .
8081
8182If set to ` false ` , assets fetched by ` @11ty/eleventy-cache-assets ` are not saved
8283in Netlify cache.
@@ -88,26 +89,40 @@ in Netlify cache.
8889directory)
8990
9091Any other folder(s) you'd like to cache across Netlify builds. If these folders
91- exist before restoring Nelify cache, they will be replaced with cached folders.
92+ exist before restoring Nelify cache, their content will be merged and overwritten
93+ with content from the cached folders.
94+
95+ ## FAQs
96+ ### I ` rimraf ` my ` _site ` on every build
97+
98+ If your images are written to ` _site/img ` (default),
99+ use ` rimraf '_site/!(img)' ` .
100+
101+ If they are in a subdirectory, say ` _site/assets/images ` ,
102+ use ` rimraf '_site/!(assets)' '_site/assets/!(images)' ` .
103+
104+ ### Are there any Benchmarks?
105+ Yes!
106+
107+ The speed-up, ofcourse, depends on how many images your website has,
108+ but here is a benchmark I used when developing this plugin:
92109
93- ## Benchmarks
94110| Run | No cache persistence | With cache persistence |
95111| -----------------------| ----------------------| --------------------------|
96112| 1st run (empty cache) | 11.74 seconds | 11.52 seconds |
97- | 2nd run (filled cache)| 11.32 seconds | ** 131.82 milliseconds** |
113+ | 2nd run (filled cache)| 11.32 seconds | 131.82 ** milliseconds** |
98114
99115[ Read more] ( https://github.com/11ty/eleventy-img/pull/116#issuecomment-882870369 )
100116
101117## Recommended Netlify plugins
102118- [ Subfont] ( https://github.com/munter/netlify-plugin-subfont )
103119- [ Inline Critical CSS] ( https://github.com/Tom-Bonnike/netlify-plugin-inline-critical-css#readme )
104120
105- ## Bugs and Feature Requests
106-
121+ ## Bug Reports, Feature Requests, and Ideas
107122Please [ create an issue] ( https://github.com/zeroby0/netlify-plugin-11ty/issues/new/ ) :)
108123
109124## License
110- MIT
125+ ** MIT**
111126
112127If you need this repository with a different License,
113128please [ create an issue] ( https://github.com/zeroby0/netlify-plugin-11ty/issues/new/ ) .
0 commit comments