- Mustache (template system)
-
Mustache is a simple web template system with language bindings available for ActionScript, C++, Clojure, CoffeeScript, ColdFusion, D, Erlang, Fantom, Go, Java, JavaScript, Lua, .NET, Objective-C, Perl, PHP, Python, Ruby and Scala. Syntax highlighting is available in Vim, Emacs, TextMate and Coda.
The Mustache templates support is built in into many Web application frameworks. The support in JavaScript includes both client-side programming with many popular JavaScript libraries and Ajax frameworks like jQuery, Dojo and YUI, as well as server-side JavaScript using Node.js and CommonJS.
Mustache is described as a "logic-less" system because it lacks any explicit control flow statements, like if and else conditionals or for loops, however both looping and conditional evaluation can be achieved using section tags processing lists and lambdas.
It is named "Mustache" because of heavy use of curly braces that resemble mustache.
Examples
The simplest template:
Hello {{name}}
Template with section tag:
{{#x}} some text {{/x}}
Here when
x
is a Boolean value then the section tag acts like an if conditional, but whenx
is an array then it acts like a foreach loop.External links
Categories:- Computer programming stubs
- Template engines
- Free development toolkits and libraries
Wikimedia Foundation. 2010.