Skip to content

Commit

Permalink
Docs for 2.0 improvements 11ty/eleventy#108
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Dec 21, 2022
1 parent d9e3647 commit ca81852
Showing 1 changed file with 31 additions and 36 deletions.
67 changes: 31 additions & 36 deletions src/docs/usage-incremental.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,37 @@ Incremental builds perform a partial build operating only on files that have cha

Incremental builds via the command line flag `--incremental` have been available without much fanfare in Eleventy for a few versions now. Let’s check in on what the current capabilities of incremental builds are and the plans to improve:

## [Passthrough Copy](/docs/copy/)

* {% addedin "0.11.0" %} Incremental passthrough copy uses the following rules:
* Only copy a passthrough copy file when it actively changed. Don’t run a template build if only a passthrough copy file has changed.
* If a template has changed, don’t copy the passthrough copy files.
* There was some discussion about making this behavior default at [Issue #1109](https://github.com/11ty/eleventy/issues/1109).
* {% addedin "2.0.0" %} Passthrough copy is now emulated during `--serve` for incremental and non-incremental builds. [Issue #2456](https://github.com/11ty/eleventy/issues/2456)

## Configuration File

If you create/update your Eleventy configuration file, a full build will run.

## Templates

* If you create/update a template file, Eleventy will run the build for that file and only that file.
* If the created/updated file is in your [Includes](/docs/config/#directory-for-includes) or [Layouts](/docs/config/#directory-for-layouts-(optional)) directories, a full build will run.
* {% addedin "1.0.0" %} This feature is also exposed as part of the API for [Custom template extensions](/docs/languages/custom/) via the `isIncrementalMatch` function.
<!-- * Implemented as part of the Eleventy Vue plugin -->
* **Templates**
* If you create/update a template file, Eleventy will run the build for that file and only that file.
* **Layouts** {% addedin "2.0.0-canary.20" %}
* When you change a layout file, any templates using that layout file are rebuilt.
* **Template Dependencies** {% addedin "2.0.0-canary.19" %}Any templates using a dependency mapped via [the `addDependencies` method](/docs/languages/custom/#registering-dependencies) will be rebuilt when those dependencies change.
* {% addedin "1.0.0" %}This feature was previously exposed as part of the API for [Custom template extensions](/docs/languages/custom/#isincrementalmatch) via the `isIncrementalMatch` function.
* **Other Includes**: If the created/updated file is in your [Includes](/docs/config/#directory-for-includes) or [Layouts](/docs/config/#directory-for-layouts-(optional)) directories, a full build will run. {% addedin "2.0.0-canary.21" %}Files used as Eleventy Layouts in your build are exempted.
* **Collections** {% addedin "2.0.0-canary.20" %}
* When you add or delete a tag from a template, any templates using that collection tag (as declared by [`pagination.data`](/docs/pagination/) or [`eleventyImport.collections`](/docs/data-configuration/#advanced)) will be rebuilt.
* [**Passthrough Copy**](/docs/copy/)
* {% addedin "0.11.0" %} Incremental passthrough copy uses the following rules:
* Only copy a passthrough copy file when it actively changed. Don’t run a template build if only a passthrough copy file has changed.
* If a template has changed, don’t copy the passthrough copy files.
* There was some discussion about making this behavior default at [Issue #1109](https://github.com/11ty/eleventy/issues/1109).
* {% addedin "2.0.0-canary.12" %} [Passthrough copy is now emulated during `--serve`](/docs/copy/#passthrough-during-serve) for incremental and non-incremental builds.
* **Configuration File**
* If you create/update your Eleventy configuration file, a full build will run.

## Additional Template Language Features

The previously stated incremental features are implemented in Eleventy core and are available to all template languages. Some template types offer additional `--incremental` build support:

* [WebC](https://www.11ty.dev/docs/languages/webc/): deep knowledge of the full component dependency graph allows us to smartly build templates that use a component when that component is changed.

## 🗓 To Do

### Templates

* [Smarter dependency map between templates](https://github.com/11ty/eleventy/issues/108):
* Eleventy layouts
* Publishing into Collections and consuming from Collections
* `11ty.js` JavaScript dependencies
* Global/directory/template Data file usage mapped to templates
* _Stretch goal_: Pagination-level incremental that operates on a subset of data
* _Stretch goal_: Work with include/extend/import/macro specific features of template languages.

### Smarter Template Language Support

* Liquid
* Nunjucks

### Cold Start

Currently incremental does a full build to start out to provide a fresh starting point to work from. Improvements will save the state of the build to a cache for faster cold starts. [Issue #984](https://github.com/11ty/eleventy/issues/984)
* **Cold Start Incremental**: `--incremental` does a full build to start out to provide a fresh starting point to work from. This feature would save the state of the build to the file system for faster cold starts. [Issue #984](https://github.com/11ty/eleventy/issues/984)
* Global/directory/template Data file usage mapped to templates (would give some improvements to serverless too)
* Template types
* `11ty.js`: Map JavaScript dependencies
* `liquid`: Dependency mapping for Liquid templates (`{% raw %}{% include %}{% endraw %}`, etc)
* ~~Dependency mapping for Nunjucks templates (`{% raw %}{% include %}{% endraw %}`, etc)~~ Unlikely due to Nunjucks API limitations.
* [Render plugin](/docs/plugins/render/): `{% raw %}{% renderFile %}{% endraw %}` dependencies
* _Stretch goal_: Pagination-level incremental that operates on a subset of data

0 comments on commit ca81852

Please sign in to comment.