Skip to content

Commit

Permalink
Release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroby0 committed Jul 27, 2021
1 parent 01bb615 commit 5cd4d9a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
39 changes: 27 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A plugin to make building with Eleventy and Netlify a joy!
### Speed up your builds ⚡
- Caches images generated by [@11ty/eleventy-img](https://github.com/11ty/eleventy-img) across builds
- Caches assets fetched by [@11ty/eleventy-cache-assets](https://github.com/11ty/eleventy-cache-assets) across builds
- Caches any other folders your choice (optional)
- Caches any other folders of your choice (optional)

## Install

Expand Down Expand Up @@ -52,7 +52,7 @@ The following `inputs` options are available:
directory)

The folder(s) in which files generated by `@11ty/eleventy-img` are stored,
relative to publish directory. Can be a string or an array of strings.
relative to the publish directory. Can be a String or an array of Strings.

If set to `false`, files generated by `@11ty/eleventy-img` are not saved in
Netlify cache.
Expand All @@ -65,8 +65,9 @@ Netlify cache.
If set to `true`, a files generated by `@11ty/eleventy-img` will be served with
http header `cache-control: public, max-age=31536000, immutable`.

This should be safe to do as the file names have a hash calculated using file
content and Sharp Options.
Files generated by eleventy_img have a hash calculated using file content and
[Sharp plugin options](https://www.11ty.dev/docs/plugins/image/#advanced-control-of-sharp-image-processor)
in their name, so you can cache them indefinitely.

### `cache_assets`

Expand All @@ -75,8 +76,8 @@ content and Sharp Options.
publish directory)

The folder(s) in which remote assets fetched by `@11ty/eleventy-cache-assets`
are cached, relative to publish directory. Can be a string or an array of
strings.
are cached, relative to publish directory. Can be a String or an array of
Strings.

If set to `false`, assets fetched by `@11ty/eleventy-cache-assets` are not saved
in Netlify cache.
Expand All @@ -88,26 +89,40 @@ in Netlify cache.
directory)

Any other folder(s) you'd like to cache across Netlify builds. If these folders
exist before restoring Nelify cache, they will be replaced with cached folders.
exist before restoring Nelify cache, their content will be merged and overwritten
with content from the cached folders.

## FAQs
### I `rimraf` my `_site` on every build

If your images are written to `_site/img` (default),
use `rimraf '_site/!(img)'`.

If they are in a subdirectory, say `_site/assets/images`,
use `rimraf '_site/!(assets)' '_site/assets/!(images)'`.

### Are there any Benchmarks?
Yes!

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

## Benchmarks
| Run | No cache persistence | With cache persistence |
|-----------------------|----------------------|--------------------------|
| 1st run (empty cache) | 11.74 seconds | 11.52 seconds |
| 2nd run (filled cache)| 11.32 seconds | **131.82 milliseconds** |
| 2nd run (filled cache)| 11.32 seconds | 131.82 **milliseconds** |

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

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

## Bugs and Feature Requests

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

## License
MIT
**MIT**

If you need this repository with a different License,
please [create an issue](https://github.com/zeroby0/netlify-plugin-11ty/issues/new/).
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "netlify-plugin-11ty",
"version": "0.0.4",
"version": "1.0.0",
"description": "A plugin to make building with Eleventy and Netlify a joy!",
"publishConfig": {
"access": "public"
Expand Down

0 comments on commit 5cd4d9a

Please sign in to comment.