Eleventy --incremental builds: global data changes not propagating to dependent templates
0 reputation · 27 Sept 2024, 01:43 UTC
Incremental builds and global data dependencies
I am configuring an Eleventy (11ty) project to use the --incremental flag so that only changed templates are rebuilt, keeping build times low on a site with a few thousand pages. The goal is for edits to a global data file (for example, a file under _data) to trigger regeneration of every template that consumes that data, without forcing a full rebuild of the whole site.
The constraint I am unsure about is how Eleventy's incremental mode tracks dependencies between global data files and templates. My understanding is that the cache in the project's cache directory records file modification state, but it is unclear whether a change to a shared data file reliably marks all downstream templates as dirty, or only templates with an explicit dependency edge. I am also unsure how this interacts with the data cascade, where data can come from directory data files and front matter layered together.
Assume Eleventy v2/v3 behavior; please note the version your answer applies to.
- Does
--incrementalguarantee that changing a global data file rebuilds every page that references it, or are there dependency shapes it misses? - Is there a documented configuration option or data-file pattern to force dependent templates to be treated as dirty?
- Is persisting the cache directory across CI runs the supported way to make incremental builds safe there, or is a full build recommended?