1
- Netlify Build plugin 11ty - A build plugin to integrate Eleventy seamlessly with
2
- Netlify.
1
+ # Netlify 11ty Build Plugin
3
2
4
- # Install
3
+ A build plugin to make building with Eleventy and Netlify a joy!
5
4
6
- Install plugin via npm as dependency
5
+ ### Speed up your builds ⚡
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
8
+ - Caches any other folders your choice (optional)
9
+
10
+ ## Install
11
+
12
+ Install plugin via npm as dependency:
7
13
8
14
** Note** : Till https://github.com/11ty/eleventy-img/pull/116 is merged,
9
- [ this fork] ( https://github.com/zeroby0/eleventy-img/tree/cache ) has to be used instead of ` @11ty/eleventy-img `
15
+ please use [ this fork] ( https://github.com/zeroby0/eleventy-img/tree/cache ) instead of ` @11ty/eleventy-img ` .
10
16
11
- ```
12
- npm install zeroby0/netlify-plugin-11ty
17
+ ``` bash
13
18
npm uninstall @11ty/eleventy-img
14
19
npm install zeroby0/eleventy-img#cache
20
+ npm install zeroby0/netlify-plugin-11ty
15
21
```
16
22
17
- And add to your ` netlify.toml ` file
23
+ And add the plugin to your ` netlify.toml ` file
18
24
19
25
``` toml
20
26
[[plugins ]]
21
27
package = " netlify-plugin-11ty"
22
28
```
23
29
24
- # configuration
30
+ ## Configuration
25
31
26
- Optionally, you can configure the plugin to match you project's needs.
32
+ Optionally, you can configure the plugin to suit your project's needs.
27
33
28
34
** Example** :
29
35
@@ -40,31 +46,33 @@ Optionally, you can configure the plugin to match you project's needs.
40
46
41
47
The following ` inputs ` options are available:
42
48
43
- #### cache_img
44
-
45
- Type: ` string ` or ` Array of strings ` Default: ` './img' ` (relative to the publish
46
- directory)
49
+ ### ` cache_img `
50
+ ** Type ** : ` String ` or ` Array of Strings `
51
+ ** Default** : ` './img' ` (relative to the publish
52
+ directory)
47
53
48
54
The folder(s) in which files generated by ` @11ty/eleventy-img ` are stored,
49
55
relative to publish directory. Can be a string or an array of strings.
50
56
51
57
If set to ` false ` , files generated by ` @11ty/eleventy-img ` are not saved in
52
58
Netlify cache.
53
59
54
- #### cache_img_httpHeader
60
+ ### ` cache_img_httpHeader `
55
61
56
- Type: boolean Default: ` true `
62
+ ** Type** : ` Boolean `
63
+ ** Default** : ` true `
57
64
58
65
If set to ` true ` , a files generated by ` @11ty/eleventy-img ` will be served with
59
66
http header ` cache-control: public, max-age=31536000, immutable ` .
60
67
61
68
This should be safe to do as the file names have a hash calculated using file
62
69
content and Sharp Options.
63
70
64
- #### cache_assets
71
+ ### ` cache_assets `
65
72
66
- Type: ` string ` or ` Array of strings ` Default: ` '../.cache' ` (relative to the
67
- publish directory)
73
+ ** Type** : ` String ` or ` Array of Strings `
74
+ ** Default** : ` '../.cache' ` (relative to the
75
+ publish directory)
68
76
69
77
The folder(s) in which remote assets fetched by ` @11ty/eleventy-cache-assets `
70
78
are cached, relative to publish directory. Can be a string or an array of
@@ -73,10 +81,33 @@ strings.
73
81
If set to ` false ` , assets fetched by ` @11ty/eleventy-cache-assets ` are not saved
74
82
in Netlify cache.
75
83
76
- #### cache_other
84
+ ### ` cache_other `
77
85
78
- Type: ` string ` or ` Array of strings ` Default: ` [] ` (relative to the publish
79
- directory)
86
+ ** Type** : ` String ` or ` Array of Strings `
87
+ ** Default** : ` [] ` (relative to the publish
88
+ directory)
80
89
81
90
Any other folder(s) you'd like to cache across Netlify builds. If these folders
82
91
exist before restoring Nelify cache, they will be replaced with cached folders.
92
+
93
+ ## Benchmarks
94
+ | Run | No cache persistence | With cache persistence |
95
+ | -----------------------| ----------------------| --------------------------|
96
+ | 1st run (empty cache) | 11.74 seconds | 11.52 seconds |
97
+ | 2nd run (filled cache)| 11.32 seconds | ** 131.82 milliseconds** |
98
+
99
+ [ Read more] ( https://github.com/11ty/eleventy-img/pull/116#issuecomment-882870369 )
100
+
101
+ ## Recommended Netlify plugins
102
+ - [ Subfont] ( https://github.com/munter/netlify-plugin-subfont )
103
+ - [ Inline Critical CSS] ( https://github.com/Tom-Bonnike/netlify-plugin-inline-critical-css#readme )
104
+
105
+ ## Bugs and Feature Requests
106
+
107
+ Please [ create an issue] ( https://github.com/zeroby0/netlify-plugin-11ty/issues/new/ ) :)
108
+
109
+ ## License
110
+ MIT
111
+
112
+ If you need this repository with a different License,
113
+ please [ create an issue] ( https://github.com/zeroby0/netlify-plugin-11ty/issues/new/ ) .
0 commit comments