# santoku-web: templates > mustache templates compiled at build time, rendered as live DOM with keyed lists, and loaded from a template folder for app.define and the server This file is one tab of the santoku reference, at https://santoku.dev/santoku-web/templates/llms.txt. https://santoku.dev/santoku-web/templates is the same tab in a browser, https://santoku.dev/llms.txt indexes every tab, and https://santoku.dev/llms-small.txt summarizes them all on one page. santoku-web's templates: santoku.mustache source compiled at build time, rendered as live DOM that updates in place, and loaded from a template folder for app.define and the server. - The rest of santoku-web is on its own tab: https://santoku.dev/santoku-web ## Apps and templates ### Templates compiled at build time santoku.web.mustache renders santoku.mustache templates as live DOM that updates in place. compile(name, source, opts) runs at build time, inside a .tk.lua file the client requires. - The .tk.lua file returns serialize(compiled, true), so the page ships the compiled tables and never the compiler. - Since santoku-web 9.0.0, compile returns a table keyed by template name: name itself and each partial it reaches, compiled once. A section that holds markup nests its template in its hole. - A section that holds only text folds into its text node. - opts.partials maps a partial's name to its source. Each {{> x}} becomes a marker the runtime fills with x, rendered with the same context. A partial sits only between elements, and a partial may include itself. - compile strips the common indentation of the source and each partial unless opts.dedent is false. - Mustache comments drop, HTML comments stay, and standalone tag lines follow the mustache spec. - The specs check the DOM against santoku.mustache's output for the same template and data. - compile raises for anything the live DOM couldn't reproduce. The error is "santoku.web.mustache", a location such as "t line 2" or "row line 2" for a partial, and a message from the tables. - Since santoku-web 4.1.0, a {{{x}}} beside elements compiles to a pair of empty comments with the raw HTML between them. | Mustache syntax error | |---| | "unclosed mustache tag" | | "delimiter changes are unsupported" | | "colon tags ({{:x}}) are unsupported" | | "{{{ without a closing }}}" | | "empty mustache tag" | | "{{x}} uses a mustach extension (guards, object iteration, escapes or json pointers)" | | "{{x}} has an empty name segment" | | "{{#x}} is never closed" | | "{{/x}} closes no section" | | "{{/x}} closes {{#y}} from line N" | | "partial x is not in the partials table" | | "{{> x}} inside : a partial sits only between elements" | | "the template holds control bytes 1 or 2" | | Parser rewrite error | |---| | " inside : the parser closes the first", for

,

  • ,
    ,
    and