Skip to content

The template language

A Weft template describes what a component, page or layout shows, what it holds and how it changes. These chapters define the language exactly.

  1. Overview

    Where templates live, and what one is made of.

  2. Lexical structure

    Names, strings, numbers, comments, keywords and the line rule.

  3. Grammar

    The whole syntax, in EBNF.

  4. Nodes

    Elements, text, if, for, slot and meta.

  5. Attributes and values

    Writing attributes, and what each becomes in the page.

  6. Components and events

    Props, slots, events, the event record, and template-only components.

  7. Expressions

    Values, operators and precedence, calls, pipes and lambdas.

  8. Standard functions

    Every function expressions can call, with an example of each.

  9. Declarations

    state, let and on: a template's own state and handlers.

  10. Data and effects

    load, requests in handlers, and timers.

  11. Pages and routing

    app/ and components/, companions, metadata, modes and the base path.

  12. Built-in elements

    Weft's elements, canvas shapes, scene objects, and the HTML attributes written.

  13. Errors

    What the parser reports, and what to do about it.