Skip to content

yesme/stache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

{stache}

{stache} is yet another mustached template system. It is named after the fact all {stache} specific expressions are quoted by {}, although it's configrable.

{stache} is inspired by {{mustache}}, handlebar, dust (and its LinkedIn port), Django, doT, Smarty, Juicer, Velocity, Jinja2 and Clearsilver.

{stache} consists of two parts:

  1. {stache} Template Language
  2. Implementation for the target language

Design Principles

  • performance, performance, performance: compile template into target language; cache
  • cross-language: C++, Java, Python, PHP, Javascript/Node, Javascript/Browser, Actionscript
  • keep it simple and stupid: general-purpose; no i18n support; no xss escape
  • powerful and pratical: no MVC fundamentalism; logic-enabled to solve common problems in an easy way;
  • extendable: user defined functions
  • configurable: delimiter
  • thread-safety / immutable: compile once, render multiple times in parallel
  • unicode supported

Some implementation details that may be considered:

  • async function definition to enable possible parallel execution
  • stream interface for rendering
  • support bigpipe by async module: content, js, css, alt
  • compile js css if needed given the global dependency

Typical Workflows

In-place render:

stache.render(tmpl, context)

Compile once at runtime, render many times:

tmpl_ = stache.compile(tmpl)
tmpl_.render(context1)
tmpl_.render(context2)

Compile into file, load later then render:

tmpl_ = stache.compile(tmpl)
tmpl_.store("compiled.tmpl")

tmpl_ = stache.load("compiled.tmpl")
tmpl_.render(context1)
tmpl_.render(context2)

About

Yet another mustached template system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published