Skip to content

Ideal Client Side Templating Language

smhinsey edited this page Feb 29, 2012 · 11 revisions

A collection of dis/under-organized ideas about the ideal client-side templating language.

Overall Syntax

Mustache/handlebars is fine, really.

Helpers & Partials

Helpers and partials are key. Helpers are used structurally. They are useful for generating UI based on logic that's too complex for the basic template syntax. Partials are used organizationally. When an app needs to be customized, or simply becomes large enough to need to be divided into modules, partials can be used as the basis for this organization.

Both helpers and partials need robust methods for defining their locations and loading semantics. Each needs to be treated as an equal partner. Helpers should be able to easily render their output using a partial, if it is advantageous, and likewise, if it makes sense, partials should be able to call helpers. Partials should be referenced by name, but it would be ideal if they could be loaded dynamically based on naming conventions or similar.

Logging

  • Multiple configurable levels, at least: FATAL, ERROR, WARNING, INFO, and DEBUG.
  • Maybe arbitrary user-defined levels, or some sort of tagging system so partials can be grouped?
  • Easy filters/sorting/searching
  • The core should use logging extensively. Verbose mode should be verbose.

Error handling

  • Configuration echoed to debug log during startup.
  • Silent (nothing displayed)
  • In-place (displays name of missing data)
  • Error (displays an error and fails entire screen)