javascriptmustacheclient-side-templatinghogan.js

Mustache-like templating language with extends?


I like the minimal-ness of mustache-style templating languages - I'm currently using mustache and icanhasmustache, but I've also checked out handlebars and hogan.

However I have a need to for an 'extends' type functionality, to allow a child to reference a particular parent template. I can't find documentation on how extends are implemented in any of the above, but I've seen (from random githib gists) that other people seem to be doing it.

Note: I'm aware of the existence of includes (sometimes called partials), however these seems to be for a parent to reference a particular child. That's the opposite of what I'm looking for - the child template in this case is the real 'base' document, the parent merely incidental, so I want the child to control the relationship.


Solution

  • Twitter's implementation of Mustache, Hogan, seems to support inheritance now.

    See this recent commit: Hogan 3. Add template inheritance...