#1253 Mustache for fantom

victor_bilyk Mon 11 Oct 2010

What is Mustache?

Mustache is a logic-free template engine inspired by ctemplate and et.

As ctemplates says, "It emphasizes separating logic from presentation: it is impossible to embed application logic in this template language".

Why?

I just needed a template engine for the application I develop with Fantom and I really like the idea of Mustache.

Usage

using mustache
Mustache template := Mustache("Hello, {{ name }}!".in)
template.render(["name":"world"])

Returns following:

Hello, world!

To get the language-agnostic overview of Mustache's template syntax and more examples of Mustache templates, see http://mustache.github.com/mustache.5.html.

Where to get it?

You can get the latest sources at http://github.com/vspy/mustache.

Licensing

Mustache for fantom is licensed under the MIT license.

I’m not a lawyer and this is not a legal advice, but it is free to use in any projects. Free as in “free beer”. Should you have any questions on licensing, consult your attorney.

IDE support

Vim

Thanks to Juvenn Woo for mustache.vim. It is included under the contrib/ directory. See http://gist.github.com/323622 for installation instructions.

Emacs

mustache-mode.el is included under the contrib/ directory for any Emacs users. Based on Google's tpl-mode for ctemplates, it adds support for Mustache's more lenient tag values and includes a few commands for your editing pleasure. See http://gist.github.com/323619 for installation instructions.

TextMate

Mustache.tmbundle See http://gist.github.com/323624 for installation instructions.

Enjoy !

brian Mon 11 Oct 2010

Very cool, nice to lots of new projects with different web APIs

Akcelisto Wed 13 Oct 2010

Yes, this is cool. Now I use MiniTemplator. I go to try Mustache.

But how enable Mustache for my pods? (For MiniTemplator: I just add miniTemplator.jar to classpath.)

victor_bilyk Wed 13 Oct 2010

Build it with

fan build.fan

And then just add it as a dependency to your project:

depends = [
  "sys 1.0", 
  "util 1.0",
  ...
  "mustache 1.0"
  ...
]

victor_bilyk Fri 18 Feb 2011

BTW, we moved {{mustache}} to bitbucket, so check the https://bitbucket.org/xored/mustache for latest version.

victor_bilyk Mon 25 Apr 2011

Hey,

I just finished making fantom {{mustache}} implementation specs-compliant. Now it fully satisfies mustache specs v1.1.2 requirements.

So, if you are using it in your project please update to the latest version ( https://bitbucket.org/xored/mustache ) and check if it still works for you :-)

If you think that something is wrong, do not hesitate to open issues at https://bitbucket.org/xored/mustache/issues

Akcelisto Tue 26 Apr 2011

Thanks. I use fantom mustache.

Akcelisto Wed 12 Sep 2012

I have idea. When I render page then sometimes I need few objs for context. I suggest that context accepts List and searches param in every obj in List. (Now context accepts Map and Obj only.)


I think, Mustache is matter because Mustache is one of two template engine on Fantom.

Login or Signup to reply.