Skip to content

template lua Reference

Leonard Ramminger edited this page Aug 22, 2026 · 1 revision

template.lua Reference

Required manifest of every template.

Minimal example

return {
  id = "my_app",
  name = "My App",
  version = "0.1.0",
  description = "Short description",
  source_dir = "files",
  output = {
    path = "{{ project_slug }}",
    overwrite = false,
  },
}

Fields

Field Required Description
id yes Unique template ID (folder name recommended)
name yes Display name in list / info
version yes Semver string for reapply policy
description no Short text
source_dir yes Relative path to source files (usually "files")
includes no List of base template IDs
output.path no Default target path when no CLI target ({{ vars }})
output.overwrite no Default existing_path_behavior (false = error)

includes

includes = { "base_cpp_common" },

See Includes & Layering.

output.path

Prebyte expression. Without a CLI target, Tempify renders into this path (relative to CWD).

Hooks

Hooks are detected as files:

  • hooks/pre.lua
  • hooks/before_render.lua
  • hooks/after_render.lua
  • hooks/post.lua

See Hooks (Authors).

layout.lua

Separate file in template root - see layout.lua.

See also

Your First Template · Template Quality

Clone this wiki locally