@@ -4,103 +4,85 @@ A plugin to make building with Eleventy and Netlify a joy!
4
4
5
5
### Speed up your builds ⚡
6
6
- Caches images generated by [ @11ty/eleventy-img ] ( https://github.com/11ty/eleventy-img ) across builds
7
- - Caches assets fetched by [ @11ty/eleventy-cache-assets ] ( https://github.com/11ty/eleventy-cache-assets ) across builds
7
+ - Caches assets fetched by [ @11ty/eleventy-fetch ] ( https://github.com/11ty/eleventy-fetch ) across builds
8
8
- Caches any other folders of your choice (optional)
9
9
10
10
## Install
11
11
12
12
Install plugin via your package manager of choice:
13
13
14
- <!-- **Note**: Till https://github.com/11ty/eleventy-img/pull/116 is merged,
15
- please use [this fork](https://github.com/zeroby0/eleventy-img/tree/cache) instead of `@11ty/eleventy-img`.
16
-
17
- ```bash
18
- npm r @11ty/eleventy-img
19
- npm i zeroby0/eleventy-img#cache
20
- npm i netlify-plugin-11ty
21
- ``` -->
22
-
23
14
``` bash
24
15
npm i netlify-plugin-11ty
25
16
```
26
17
27
- And add the plugin to your ` netlify.toml ` file
28
-
29
- ``` toml
30
- [[plugins ]]
31
- package = " netlify-plugin-11ty"
32
- ```
33
-
34
- Aand you're done! 🥳
35
-
36
- You can read Netlify's documentation about Plugins here: https://docs.netlify.com/configure-builds/build-plugins/
37
-
38
- ## Configuration
39
-
40
- ** Optional** . You can configure the plugin to suit your project's needs.
41
-
42
- ** Example** :
18
+ And add the plugin to your ` netlify.toml ` file:
43
19
44
20
``` toml
45
21
[[plugins ]]
46
22
package = " netlify-plugin-11ty"
47
23
[plugins .inputs ]
48
- cache_img = ' ./img'
24
+ # eleventy-img outputDir, path relative to publish directory
25
+ cache_img = ' img/'
49
26
cache_img_httpHeader = false
50
27
51
- cache_assets = ' ../.cache'
28
+ # eleventy-fetch cacheDir, path relative to publish directory
29
+ cache_assets = ' ../.cache/'
52
30
cache_other = []
53
31
```
54
32
55
- The following ` inputs ` options are available:
33
+ Make sure the path for [ ` cache_img ` ] ( #1-cache_img ) is correct. Aand you're done! 🥳
34
+
35
+ You can read Netlify's documentation about Plugins here: https://docs.netlify.com/configure-builds/build-plugins/
36
+
37
+ ## Documentation
38
+
39
+ ### 1. ` cache_img `
56
40
57
- ### 1. ` cache_img `
58
- ** Type** : ` String ` or ` Array of Strings `
59
- ** Default** : ` './img' ` (relative to the publish
60
- directory)
41
+ Type: ` String ` or ` Array of Strings `
42
+ Default: ` 'img' ` (relative to the publish directory)
61
43
62
- The folder(s) in which files generated by ` @11ty/eleventy-img ` are stored,
44
+ Path to the folder(s) in which files generated by ` @11ty/eleventy-img ` are stored,
63
45
relative to the publish directory. Can be a String or an array of Strings.
64
46
65
47
If set to ` false ` , files generated by ` @11ty/eleventy-img ` are not saved in
66
48
Netlify cache.
67
49
68
50
### 2. ` cache_img_httpHeader `
69
51
70
- ** Type** : ` Boolean `
71
- ** Default** : ` false `
52
+ Type: ` Boolean `
53
+ Default: ` false `
72
54
73
55
If set to ` true ` , files generated by ` @11ty/eleventy-img ` will be served with
74
56
http header ` cache-control: public, max-age=31536000, immutable ` .
75
57
76
58
Files generated by ` eleventy_img ` have a hash calculated using file content and
77
59
[ Sharp plugin options] ( https://www.11ty.dev/docs/plugins/image/#advanced-control-of-sharp-image-processor )
78
60
in their name by default ([ starting from #116 ] ( https://github.com/11ty/eleventy-img/pull/116 ) ),
79
- so you can cache them indefinitely.
61
+ so you can cache them indefinitely. Don't use this if you're using remote images.
80
62
81
- If you are using [ custom filenames] ( https://www.11ty.dev/docs/plugins/image/#custom-filenames-new-in-image-0.4.0 )
82
- that don't include a hash, this option should be left ` false ` (default).
63
+ :warning : ** Caution** :
64
+ - If you are using remote images, this option should be ` false ` (default).
65
+ - If you are using [ custom filenames] ( https://www.11ty.dev/docs/plugins/image/#custom-filenames-new-in-image-0.4.0 )
66
+ that don't include a hash, this option should be ` false ` (default).
83
67
84
68
### 3. ` cache_assets `
85
69
86
- ** Type** : ` String ` or ` Array of Strings `
87
- ** Default** : ` '../.cache' ` (relative to the
88
- publish directory)
70
+ Type: ` String ` or ` Array of Strings `
71
+ Default: ` '../.cache' ` (relative to the publish directory)
89
72
90
- The folder(s) in which remote assets fetched by ` @11ty/eleventy-cache-assets `
73
+ Path to the folder(s) in which remote assets fetched by [ @11ty/eleventy-fetch ] ( https://github.com/11ty/eleventy-fetch )
91
74
are cached, relative to publish directory. Can be a String or an array of
92
75
Strings.
93
76
94
- If set to ` false ` , assets fetched by ` @11ty/eleventy-cache-assets ` are not saved
77
+ If set to ` false ` , assets fetched by ` @11ty/eleventy-fetch ` are not saved
95
78
in Netlify cache.
96
79
97
80
### 4. ` cache_other `
98
81
99
- ** Type** : ` String ` or ` Array of Strings `
100
- ** Default** : ` [] ` (relative to the publish
101
- directory)
82
+ Type: ` String ` or ` Array of Strings `
83
+ Default: ` [] ` (relative to the publish directory)
102
84
103
- Any other folder(s) you'd like to cache across Netlify builds. If these folders
85
+ Paths to any other folder(s) you'd like to cache across Netlify builds. If these folders
104
86
exist before restoring Nelify cache, their content will be merged and overwritten
105
87
with content from the cached folders.
106
88
0 commit comments