Repository navigation
Includes and Layering
Leonard Ramminger edited this page Aug 22, 2026
·
1 revision
Compose templates from other templates.
return {
id = "layered_cpp_product",
-- ...
includes = { "layered_cpp_base", "layered_ci_overlay" },
merge = {
file_conflicts = {
["src/main.cpp.pbt"] = "replace",
},
drop_paths = { "base-only.txt" },
},
}Alternatively: separate includes.lua in template root (list of IDs).
- Includes are loaded in order and resolved recursively
- The current template is on top (highest priority)
- Cycles (
A→B→A) cause an error
| Field | Effect |
|---|---|
file_conflicts |
Strategy for same relative path |
drop_paths |
Remove paths from merge result (including subdirs) |
question_conflicts |
How questions with the same key merge |
pre_hook_conflict / post_hook_conflict
|
Hook collisions between includes |
| Value | Meaning |
|---|---|
replace |
Overlay wins (default for files) |
keep |
Keep base |
error |
Abort with TempifyError
|
Wildcards: ["*.pbt"] = "keep" matches file extensions.
| Area | Behavior |
|---|---|
| Files & directories | Per file_conflicts
|
| Questions | Per question_conflicts (default: replace) |
layout.lua rules |
Append |
| Scripts | Replace by name |
pre / post hooks |
Configurable; before_render / after_render from top template |
| Manifest metadata | ID/version/output from top template |
layered_cpp_base/ → README, main.cpp, base-only.txt
layered_ci_overlay/ → CI workflow, README overlay
layered_cpp_product/ → includes both, drops base-only, replaces main.cpp
tempify inspect layered_cpp_productTempify · Repository · Issues · Releases
Documentation lives in this wiki. For a build quickstart, see the README in the repository.
Prebyte (template engine) is a separate project bundled by Tempify.
- CLI Reference
- Questions & Answers
- Configuration
- Render Options
- Hooks (Users)
- Reapply & Diff
- Shared Template Store
- Prebyte Passthrough
- Shell Completion