Skip to content

Commit 5930dc2

Browse files
committed
linter
1 parent eca84d4 commit 5930dc2

File tree

1 file changed

+58
-42
lines changed

1 file changed

+58
-42
lines changed

README.md

Lines changed: 58 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
A plugin to make building with Eleventy and Netlify a joy!
44

55
### 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-fetch](https://github.com/11ty/eleventy-fetch) across builds
6+
7+
- Caches images generated by
8+
[@11ty/eleventy-img](https://github.com/11ty/eleventy-img) across builds
9+
- Caches assets fetched by
10+
[@11ty/eleventy-fetch](https://github.com/11ty/eleventy-fetch) across builds
811
- Caches any other folders of your choice (optional)
912

1013
## Install
@@ -30,79 +33,86 @@ And add the plugin to your `netlify.toml` file:
3033
cache_other = []
3134
```
3235

33-
Make sure the path for [`cache_img`](#1-cache_img) is correct. Aand you're done! 🥳
36+
Make sure the path for [`cache_img`](#1-cache_img) is correct. Aand you're done!
37+
🥳
3438

35-
You can read Netlify's documentation about Plugins here: https://docs.netlify.com/configure-builds/build-plugins/
39+
You can read Netlify's documentation about Plugins here:
40+
https://docs.netlify.com/configure-builds/build-plugins/
3641

37-
**Note**: If your builds are failing, the version of Node
38-
you're using is probably not supported by Netlify.
39-
Try Node v16.x.x.
40-
See the [FAQs section](#my-builds-are-failing) for more info.
42+
**Note**: If your builds are failing, the version of Node you're using is
43+
probably not supported by Netlify. Try Node v16.x.x. See the
44+
[FAQs section](#my-builds-are-failing) for more info.
4145

4246
## Documentation
4347

44-
### 1. `cache_img`
48+
### 1. `cache_img`
4549

46-
Type: `String` or `Array of Strings`
47-
Default: `'img'` (relative to the publish directory)
50+
Type: `String` or `Array of Strings`
51+
Default: `'img'` (relative to the publish directory)
4852

49-
Path to the folder(s) in which files generated by `@11ty/eleventy-img` are stored,
50-
relative to the publish directory. Can be a String or an array of Strings.
53+
Path to the folder(s) in which files generated by `@11ty/eleventy-img` are
54+
stored, relative to the publish directory. Can be a String or an array of
55+
Strings.
5156

5257
If set to `false`, files generated by `@11ty/eleventy-img` are not saved in
5358
Netlify cache.
5459

5560
### 2. `cache_img_httpHeader`
5661

57-
Type: `Boolean`
58-
Default: `false`
62+
Type: `Boolean`
63+
Default: `false`
5964

6065
If set to `true`, files generated by `@11ty/eleventy-img` will be served with
6166
http header `cache-control: public, max-age=31536000, immutable`.
6267

6368
Files generated by `eleventy_img` have a hash calculated using file content and
6469
[Sharp plugin options](https://www.11ty.dev/docs/plugins/image/#advanced-control-of-sharp-image-processor)
65-
in their name by default ([starting from #116](https://github.com/11ty/eleventy-img/pull/116)),
66-
so you can cache them indefinitely. Don't use this if you're using remote images.
70+
in their name by default
71+
([starting from #116](https://github.com/11ty/eleventy-img/pull/116)), so you
72+
can cache them indefinitely. Don't use this if you're using remote images.
6773

6874
:warning: **Caution**:
75+
6976
- If you are using remote images, this option should be `false` (default).
70-
- If you are using [custom filenames](https://www.11ty.dev/docs/plugins/image/#custom-filenames-new-in-image-0.4.0)
71-
that don't include a hash, this option should be `false` (default).
77+
- If you are using
78+
[custom filenames](https://www.11ty.dev/docs/plugins/image/#custom-filenames-new-in-image-0.4.0)
79+
that don't include a hash, this option should be `false` (default).
7280

7381
### 3. `cache_assets`
7482

7583
Type: `String` or `Array of Strings`
76-
Default: `'../.cache'` (relative to the publish directory)
84+
Default: `'../.cache'` (relative to the publish directory)
7785

78-
Path to the folder(s) in which remote assets fetched by [@11ty/eleventy-fetch](https://github.com/11ty/eleventy-fetch)
79-
are cached, relative to publish directory. Can be a String or an array of
80-
Strings.
86+
Path to the folder(s) in which remote assets fetched by
87+
[@11ty/eleventy-fetch](https://github.com/11ty/eleventy-fetch) are cached,
88+
relative to publish directory. Can be a String or an array of Strings.
8189

82-
If set to `false`, assets fetched by `@11ty/eleventy-fetch` are not saved
83-
in Netlify cache.
90+
If set to `false`, assets fetched by `@11ty/eleventy-fetch` are not saved in
91+
Netlify cache.
8492

8593
### 4. `cache_other`
8694

8795
Type: `String` or `Array of Strings`
88-
Default: `[]` (relative to the publish directory)
96+
Default: `[]` (relative to the publish directory)
8997

90-
Paths to any other folder(s) you'd like to cache across Netlify builds. If these folders
91-
exist before restoring Nelify cache, their content will be merged and overwritten
92-
with content from the cached folders.
98+
Paths to any other folder(s) you'd like to cache across Netlify builds. If these
99+
folders exist before restoring Nelify cache, their content will be merged and
100+
overwritten with content from the cached folders.
93101

94102
## FAQs
103+
95104
### I `rimraf` my `_site` on every build
96105

97-
If your images are written to `_site/img` (default),
98-
use `rimraf '_site/!(img)'`.
106+
If your images are written to `_site/img` (default), use
107+
`rimraf '_site/!(img)'`.
99108

100-
If they are in a subdirectory, say `_site/assets/images`,
101-
use `rimraf '_site/!(assets)' '_site/assets/!(images)'`.
109+
If they are in a subdirectory, say `_site/assets/images`, use
110+
`rimraf '_site/!(assets)' '_site/assets/!(images)'`.
102111

103112
### My builds are failing
104113

105114
If your build fails with
115+
106116
```bash
107117
11:37:10 AM: Uncaught exception, the process will now terminate…
108118
11:37:10 AM: Error: Unable to deserialize cloned data due to invalid or unsupported version.
@@ -120,34 +130,40 @@ echo "16" > .nvmrc
120130
```
121131

122132
More info about this error:
133+
123134
- https://answers.netlify.com/t/netlify-build-cache-error/78115/4
124135
- https://answers.netlify.com/t/build-failing-after-upgrade-to-node-18/75774
125136

126137
See this guide for more ways to set Node versions:
127138
https://docs.netlify.com/configure-builds/manage-dependencies/
128139

129140
### Are there any Benchmarks?
141+
130142
Yes!
131143

132-
The speed-up, ofcourse, depends on how many images your website has,
133-
but here is a benchmark I used when developing this plugin:
144+
The speed-up, ofcourse, depends on how many images your website has, but here is
145+
a benchmark I used when developing this plugin:
134146

135-
| Run | No cache persistence | With cache persistence |
136-
|-----------------------|----------------------|--------------------------|
137-
| 1st run (empty cache) | 11.74 seconds | 11.52 seconds |
138-
| 2nd run (filled cache)| 11.32 seconds | 131.82 **milliseconds** |
147+
| Run | No cache persistence | With cache persistence |
148+
| ---------------------- | -------------------- | ----------------------- |
149+
| 1st run (empty cache) | 11.74 seconds | 11.52 seconds |
150+
| 2nd run (filled cache) | 11.32 seconds | 131.82 **milliseconds** |
139151

140152
[Read more](https://github.com/11ty/eleventy-img/pull/116#issuecomment-882870369)
141153

142154
## Recommended Netlify plugins
155+
143156
- [Subfont](https://github.com/munter/netlify-plugin-subfont)
144157
- [Inline Critical CSS](https://github.com/Tom-Bonnike/netlify-plugin-inline-critical-css#readme)
145158

146159
## Bug Reports, Feature Requests, and Ideas
147-
Please [create an issue](https://github.com/zeroby0/netlify-plugin-11ty/issues/new/) :)
160+
161+
Please
162+
[create an issue](https://github.com/zeroby0/netlify-plugin-11ty/issues/new/) :)
148163

149164
## License
165+
150166
**MIT**
151167

152-
If you need this repository with a different License,
153-
please [create an issue](https://github.com/zeroby0/netlify-plugin-11ty/issues/new/).
168+
If you need this repository with a different License, please
169+
[create an issue](https://github.com/zeroby0/netlify-plugin-11ty/issues/new/).

0 commit comments

Comments
 (0)