Skip to content

Commit

Permalink
Update Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroby0 committed Jul 20, 2021
1 parent 5b2cfc8 commit 79e2851
Showing 1 changed file with 53 additions and 22 deletions.
75 changes: 53 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
Netlify Build plugin 11ty - A build plugin to integrate Eleventy seamlessly with
Netlify.
# Netlify 11ty Build Plugin

# Install
A build plugin to make building with Eleventy and Netlify a joy!

Install plugin via npm as dependency
### 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)

## Install

Install plugin via npm as dependency:

**Note**: Till https://github.com/11ty/eleventy-img/pull/116 is merged,
[this fork](https://github.com/zeroby0/eleventy-img/tree/cache) has to be used instead of `@11ty/eleventy-img`
please use [this fork](https://github.com/zeroby0/eleventy-img/tree/cache) instead of `@11ty/eleventy-img`.

```
npm install zeroby0/netlify-plugin-11ty
```bash
npm uninstall @11ty/eleventy-img
npm install zeroby0/eleventy-img#cache
npm install zeroby0/netlify-plugin-11ty
```

And add to your `netlify.toml` file
And add the plugin to your `netlify.toml` file

```toml
[[plugins]]
package = "netlify-plugin-11ty"
```

# configuration
## Configuration

Optionally, you can configure the plugin to match you project's needs.
Optionally, you can configure the plugin to suit your project's needs.

**Example**:

Expand All @@ -40,31 +46,33 @@ Optionally, you can configure the plugin to match you project's needs.

The following `inputs` options are available:

#### cache_img

Type: `string` or `Array of strings` Default: `'./img'` (relative to the publish
directory)
### `cache_img`
**Type**: `String` or `Array of Strings`
**Default**: `'./img'` (relative to the publish
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.

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

#### cache_img_httpHeader
### `cache_img_httpHeader`

Type: boolean Default: `true`
**Type**: `Boolean`
**Default**: `true`

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.

#### cache_assets
### `cache_assets`

Type: `string` or `Array of strings` Default: `'../.cache'` (relative to the
publish directory)
**Type**: `String` or `Array of Strings`
**Default**: `'../.cache'` (relative to the
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
Expand All @@ -73,10 +81,33 @@ strings.
If set to `false`, assets fetched by `@11ty/eleventy-cache-assets` are not saved
in Netlify cache.

#### cache_other
### `cache_other`

Type: `string` or `Array of strings` Default: `[]` (relative to the publish
directory)
**Type**: `String` or `Array of Strings`
**Default**: `[]` (relative to the publish
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.

## 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** |

[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

Please [create an issue](https://github.com/zeroby0/netlify-plugin-11ty/issues/new/) :)

## License
MIT

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

0 comments on commit 79e2851

Please sign in to comment.