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.txt → README.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

Field Description
source Relative path under source_dir
target Relative output path (optional; default = source with .pbt suffix logic)
render true = Prebyte, false = raw copy
exclude true = 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