Edgar has posted 1 posts at DZone. View Full User Profile

Hello Handlebars.java!

07.01.2012
| 2710 views |
  • submit to reddit

Handlebars provides the power necessary to let you build semantic templates effectively with no frustration.

Mustache templates are compatible with Handlebars, so you can take a Mustache template, import it into Handlebars, and start taking advantage of the extra Handlebars features.

Getting Started 

In general, the syntax of Handlebars templates is a superset of Mustache templates. For basic syntax, check out the Mustache manpage.

Maven

Current version: 0.2.0

 

  <dependency>
    <groupId>com.github.edgarespina</groupId>
    <artifactId>handlebars</artifactId>
    <version>${handlebars-version}</version>
  </dependency>

 

Hello Handlebars.java

Handlebars handlebars = new Handlebars();

Template template = handlebars.compile("Hello {{.}}!");

System.out.println(template.apply("Handlebars.java"));

 

Output:

 

Hello Handlebars.java!

 

 Want to learn more? Have a look to the project at https://github.com/edgarespina/handlebars.java 

0
Published at DZone with permission of its author, Edgar Espina.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)