- Stable
3.0.0
Toggle Menu
Eleventy
5.81s
Remix
40.14s
Order of Operations
From a very high level, Eleventy’s internal order of operations is such:
- Find any file matching a valid Eleventy file extension in the Input directory (e.g.
./src/**.njk
or./docs/**.md
). - Iterate over the files.
- If it doesn’t match a template file extension, treat it as a passthrough copy.
- If it does match a template file extension, continue processing as an Eleventy template.
- Start the asynchronous copy of passthrough copy. This includes files specified via passthrough copy in Eleventy’s configuration and files with non-template-matching file extensions. This will continue in parallel while templates are being processed.
- Initial Data Cascade is generated for each template file. This includes all values from front matter, layouts, directory and file data files, and global data.
- The data cascade does not yet include populated
collections
,templateContent
, or computedpage
values (e.g.page.url
andpage.outputPath
).
- The data cascade does not yet include populated
- A dependency graph of the templates is created to process them in the correct order.
- This is a bit oversimplified and some may mix-and-match, if they aren’t dependent on each other. From a high level, the templates are processed like this (listed here in reverse order—
1
is processed first):- Templates that use Pagination and target
collections.all
- Templates that use Pagination and target
collections
- Templates that use Pagination and target a Configuration API-added collection
- Templates that use Pagination and target any other Collection (those supplied via
tags
) - Templates that have
tags
specified - Templates that have no dependencies or who are excluded via
eleventyExcludeFromCollections
- Templates that use Pagination and target
- Note: Eleventy does not automatically know what data is used inside of template content at this stage. Eleventy uses front matter to determine which templates supply collections, and which templates consume collections. (For a safety net, you can use
eleventyImport
in front matter option to declare dependencies manually.)
- This is a bit oversimplified and some may mix-and-match, if they aren’t dependent on each other. From a high level, the templates are processed like this (listed here in reverse order—
- Collections are generated in the correct order, per the dependency graph.
- Additional Data Cascade operations are applied:
- A separate dependency graph is generated to populate Computed Data,
permalink
,page.url
, andpage.outputPath
in the correct order.
- A separate dependency graph is generated to populate Computed Data,
- Templates are rendered (
templateContent
is generated) in the order generated by the dependency graph without layouts applied.- Per the above Note, if one template uses another template’s
templateContent
before it has been generated, we defer the first template to render in a second pass. - After all
templateContent
s have been rendered, they are copied into the appropriate collections’ objects. (Remember: at this pointtemplateContent
incollections
still do not include layouts.)
- Per the above Note, if one template uses another template’s
- Eleventy checks for duplicate permalinks and throws an error if more than one template attempts to write to the same output file.
- Layouts are applied to templates. The previously generated
templateContent
values (without layouts) are re-used here. - The content is written to files on disk.