Juzu has Mustache!
Juzu 0.5 will be released soon and will provide many new great features. Among them now the Mustache templating engine is supported. Mustache is a logic-less templating engine that is language agnostic:
It was important for me to support a second templating language and Mustache is a great choice because:
- it demonstrate that Juzu can use different templating engine
- some people wants logic-less languages and try to avoid code in templates
- it provides that Juzu core is not coupled to the current templating engine
- Mustache.java implementation has a good architecture and is easy to embed / integrate
- Mustache is easy to use and understand
- Mustache can also be used on the client side and later an application could use the same template both on the server and the client
The integration relies on Mustache.java:
- mustaches (that’s the name of a mustache file) are also in the “templates” package and ends with “.mustache”
- mustache are used and declared exactly the same way than .gtmpl templates (i.e @Inject Path(“index.mustache”) Template
- Mustache can also have type safe parameters using the pragma notion which is an extension of Mustache.java : anywhere in the template
- At the moment taglibs are coupled to the native groovy template engine and cannot be used. I don’t know if it’s feasible to be able to integrate a tag lib with a .mustache
- 5/ Mustache is not embedded in Juzu core and instead is provided as an independent jar : juzu-templating-mustache . The main reason is that Mustache.java relies on the Mustache.java library but also on Google Guava. I want to keep juzu-core the less coupled to third party library.
blog comments powered by Disqus
Published
08 June 2012