Skip to content

layout lua

Leonard Ramminger edited this page Aug 22, 2026 · 2 revisions

layout.lua

Explicit control of source and target paths per file.

When do you need this?

By default, Tempify mirrors the folder structure under files/ into the target. layout.lua overrides that:

  • different target paths (docs/readme.txtREADME.md)
  • raw copy instead of Prebyte (render = false)
  • exclude files (exclude = true)

Format

layout.lua in template root - a list of rules:

return {
{
source="docs/readme.txt.pbt",
target="README.md.pbt",
render=true,
},
{
source="raw/static.txt.pbt",
target="static/output.txt",
render=false,
},
{
source="notes/todo.txt.pbt",
exclude=true,
},
}

Fields

FieldDescription
sourceRelative path under source_dir
targetRelative output path (optional; default = source with .pbt suffix logic)
rendertrue = Prebyte, false = raw copy
excludetrue = do not include file in output

Combining with includes

Layout rules from includes and the current template are appended (not replaced). Order follows the include chain.

Verify

tempify inspect advanced_hooks_layout

Reference template: tests/test_templates/advanced_hooks_layout/

See also

Files & Prebyte · Includes & Layering

Clone this wiki locally