Dependency reference
Per-page *.deps.json.
A tracked page can declare additional build dependencies in a JSON sidecar beside its content file. This is useful when a dependency belongs to the page but is not naturally referenced from the template with @input or declared inline with @dep(...).
File naming
Nift takes the tracked content path and replaces its extension with .deps.json.
content/docs/getting-started.html
content/docs/getting-started.deps.json Format
{
"dependencies": [
"data/navigation.json",
"assets/generated/search-index.json",
"shared/content/"
]
} The document root must be an object, dependencies must be an array, and every member must be a string naming an existing project-relative file or directory. Invalid dependency metadata is reported as a build problem rather than being silently ignored.
Files and directories
Dependencies can point at files or directories. Directory dependencies participate in incremental change detection recursively, including additions and changes below nested subdirectories in hash-aware modes.
When to use it
| Mechanism | Best fit |
|---|---|
@input(...) | The file is actually rendered into the current document. Nift records the dependency automatically. |
@dep(...) | The dependency matters exactly where the template/content is being authored, but its contents are not inserted. |
*.deps.json | The dependency is page-level build metadata, generated by another tool, or clearer when kept outside the template. |
Use automatic dependencies for normal composition, @dep when the relationship belongs in the source, and *.deps.json when it belongs beside the tracked page as build metadata.
Incremental behaviour
After a successful build, user-defined dependencies are included in the page's build metadata. status and build-updated check them using the configured modified, hash or hybrid mode just like dependencies discovered while rendering.
Dependencies stay inside the project
@dep(...) is project build metadata, so its paths must remain inside the Nift project. Parent traversal or an absolute path escaping the project is rejected rather than allowing incremental state to depend on arbitrary files elsewhere on the machine.
@dep(...) →