Mustache

Mustache

mustache.github.io

1

About this website

Mustache is a logic-less template system available for over 30 programming languages, designed by Chris Wanstrath (co-founder of the popular code hosting platform) in 2009. With the philosophy of being logic-less, this template engine deliberately omits if/else statements, loops, and other control flow from templates, enforcing a clean separation between presentation (templates) and logic (code). Templates use double-brace tags (the resemblance to a mustache giving the system its name) to mark placeholders and sections. Supported tag types include: variables (rendering the value of a key, HTML-escaped by default), unescaped variables (rendering raw HTML without escaping), sections (rendering the block once for each item in a list, or conditionally if the value is truthy), inverted sections (rendering the block when the value is falsy or the list is empty), comments, partials (including another template file), set delimiter (changing the tag syntax for the rest of the template), and blocks with inheritance in some implementations. The data model is simple: any key in the template maps to a value in the data object (called the context or view), which can be a string, number, boolean, list, or nested object. Implementations exist for Ruby, JavaScript, Python, PHP, Java, Go, Rust, C#, Clojure, Haskell, Erlang, Scala, Swift, Lua, Perl, OCaml, Common Lisp, ColdFusion, ActionScript, Delphi, and many others, with the reference specification maintained in the official documentation.

Tags & Categories

Statistics

1
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!