https://github.com/trimou/trimou
Mustache/handlebars templating engine in Java.
https://github.com/trimou/trimou
Last synced: 8 months ago
JSON representation
Mustache/handlebars templating engine in Java.
- Host: GitHub
- URL: https://github.com/trimou/trimou
- Owner: trimou
- License: apache-2.0
- Created: 2013-05-14T20:39:22.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2023-10-10T21:19:55.000Z (about 2 years ago)
- Last Synced: 2024-03-27T05:17:45.630Z (almost 2 years ago)
- Language: Java
- Homepage: http://www.trimou.org
- Size: 2.29 MB
- Stars: 79
- Watchers: 6
- Forks: 17
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-java - Trimou
README
# Trimou - Trim Your Mustache Templates!
[](http://trimou.org/)
[](http://search.maven.org/#search|ga|1|trimou-core)
[](https://gitter.im/trimou/trimou)
[](http://www.apache.org/licenses/LICENSE-2.0.html)
Trimou is a templating engine.
It's a [Mustache](https://github.com/mustache) implementation but **Helpers API** inspired by [Handlebars.js](http://handlebarsjs.com/) 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](http://www.cdi-spec.org/), Servlets, [PrettyTime](http://ocpsoft.org/prettytime/), [HtmlCompressor](http://code.google.com/p/htmlcompressor/), [google-gson](http://code.google.com/p/google-gson/), [JSON Processing Object Model API (JSR 353)](https://jsonp.java.net/), [Spring MVC](http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html), [Dropwizard](https://dropwizard.github.io/dropwizard/) and [EL 3.0](https://uel.java.net/).
## Get Started
All the artifacts are available in the Maven Central Repository:
```xml
org.trimou
trimou-core
${version.trimou}
```
Use the `MustacheEngineBuilder` to build a `MustacheEngine` - a central point for template management.
```java
// 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"));
```
## Examples
* a really [simple example](https://github.com/trimou/trimou/tree/master/examples/simple)
* a little bit more complex [web application example](https://github.com/trimou/trimou/tree/master/examples/ping).
* a small example using [Spring Boot auto-configuration](https://github.com/trimou/trimou/tree/master/examples/spring-boot)
## Building Trimou
Simply run:
> $ mvn clean install