| name | templating |
| description | Render any text file (HTML, markdown, config, SQL, email) from a mustache template plus JSON data. Use when an output's shape is fixed ahead of time and only the values change. |
templating — fill data into text-file templates
Render any text file (HTML, markdown, config, SQL, email, …) from a
mustache template plus JSON data. Use this whenever the shape of an output
is known ahead of time and only the values change — it is faster and less
error-prone than writing the file by hand.
Other skills build on this one (e.g. slides composes presentation decks
from slide templates).
Quick reference
| Task | Command |
|---|
| Render with inline data | create-from-template --template t.html --data '{"name":"Ada"}' --output out.html |
| Render with a data file | create-from-template --template t.html --data @data.json --output out.html |
| Fail on missing keys | add --strict |
| Overwrite existing output | add -f |
Use partials ({{>name}}) | add --partials-dir ./partials |
The command prints the absolute output path on success and exits non-zero
with a message on any error (bad JSON, missing template, existing output
without -f, missing keys under --strict).
Template syntax (mustache)
| Syntax | Meaning |
|---|
{{name}} | Insert value, HTML-escaped |