Mustache/handlebars templating engine in Java.
Trimou is a templating engine.
It’s a Mustache implementation but Helpers API inspired by Handlebars.js is also supported.
The goal is to provide a simple to use and easy to extend templating engine for any Java SE or Java EE application.
There are some ready-to-use extensions which provide integration with CDI, Servlets, PrettyTime, HtmlCompressor, google-gson, JSON Processing Object Model API (JSR 353), Spring MVC, Dropwizard and EL 3.0.
All the artifacts are available in the Maven Central Repository:
<dependency>
<groupId>org.trimou</groupId>
<artifactId>trimou-core</artifactId>
<version>${version.trimou}</version>
</dependency>
Use the MustacheEngineBuilder
to build a MustacheEngine
- a central point for template management.
// Build the engine - don't configure anything but use sensible defaults
MustacheEngine engine = MustacheEngineBuilder.newBuilder().build();
// Compile the template - no caching and no template locators used
Mustache mustache = engine.compileMustache("Hello {{this}}!");
// Render "Hello world!"
System.out.println(mustache.render("world"));
Simply run:
$ mvn clean install