Mustache logic-less templates à la Trimou


News: Mustache logic-less templates à la Trimou

  1. Mustache logic-less templates à la Trimou (2 messages)

    Have you ever heard of Mustache logic-less templates? The Mustache philosophy is based on simplicity and logic-less nature. The rules are defined in a kind of specification (actually it's just a set of tests - a kind of TCK for Java standard). There are many implementations out there: JavaScript, Ruby, ... and of course Java.

    Despite Mustache templates are popular especially on the client side it's possible to use it on the server side as well. And benefits? It has simple yet powerful syntax. It's performant and alo resistant to bad practices such as complicated JSP scriptlets. It's also universal, i.e. you could use it to render any text documents (web pages, e-mails, etc.).

    Java developers mostly know JSP, Velocity, Freemarker and JSF Facelets. These tools are feature-rich, mature and proven. Still they're not perfect (actually nothing is). So if none of those "proven" tools fits your needs without tradeoffs try Trimou!

    Trimou is an open source Mustache implementation focused on extensibility and configurability. There are some useful built-in extensions: CDI, Servlet, PrettyTime, Minify and google-gson. It also has a decent test coverage and documentation. Since 1.5.0 Trimou defines a helper API inspired by Handlebars project.

    See also the project site:

    Don't forget to check the example web application!

    Threaded Messages (2)

  2. Handlebars[ Go to top ]

    If you want to go with Mustache, Handlebars is a more powerful implementation of Mustache with a number of useful extensions. It also has a Java implementation 

  3. RE: Handlebars[ Go to top ]

    I fact, "helpers" are the most useful value added by Handlebars and as written above, Trimou defines a helper API inspired by Handlebars project.