@@ -5,7 +5,7 @@ A plugin to make building with Eleventy and Netlify a joy!
5
5
### Speed up your builds ⚡
6
6
- Caches images generated by [ @11ty/eleventy-img ] ( https://github.com/11ty/eleventy-img ) across builds
7
7
- 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)
9
9
10
10
## Install
11
11
@@ -52,7 +52,7 @@ The following `inputs` options are available:
52
52
directory)
53
53
54
54
The 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 .
56
56
57
57
If set to ` false ` , files generated by ` @11ty/eleventy-img ` are not saved in
58
58
Netlify cache.
@@ -65,8 +65,9 @@ Netlify cache.
65
65
If set to ` true ` , a files generated by ` @11ty/eleventy-img ` will be served with
66
66
http header ` cache-control: public, max-age=31536000, immutable ` .
67
67
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.
70
71
71
72
### ` cache_assets `
72
73
@@ -75,8 +76,8 @@ content and Sharp Options.
75
76
publish directory)
76
77
77
78
The 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 .
80
81
81
82
If set to ` false ` , assets fetched by ` @11ty/eleventy-cache-assets ` are not saved
82
83
in Netlify cache.
@@ -88,26 +89,40 @@ in Netlify cache.
88
89
directory)
89
90
90
91
Any 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:
92
109
93
- ## Benchmarks
94
110
| Run | No cache persistence | With cache persistence |
95
111
| -----------------------| ----------------------| --------------------------|
96
112
| 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** |
98
114
99
115
[ Read more] ( https://github.com/11ty/eleventy-img/pull/116#issuecomment-882870369 )
100
116
101
117
## Recommended Netlify plugins
102
118
- [ Subfont] ( https://github.com/munter/netlify-plugin-subfont )
103
119
- [ Inline Critical CSS] ( https://github.com/Tom-Bonnike/netlify-plugin-inline-critical-css#readme )
104
120
105
- ## Bugs and Feature Requests
106
-
121
+ ## Bug Reports, Feature Requests, and Ideas
107
122
Please [ create an issue] ( https://github.com/zeroby0/netlify-plugin-11ty/issues/new/ ) :)
108
123
109
124
## License
110
- MIT
125
+ ** MIT**
111
126
112
127
If you need this repository with a different License,
113
128
please [ create an issue] ( https://github.com/zeroby0/netlify-plugin-11ty/issues/new/ ) .
0 commit comments