→ Haml + Mustache
12 February 2010
Haml and Mustache are friends, not enemies.
See for yourself.
example.yml
---
users:
- { user: chris }
- { user: bob }
- { user: jones }
---
example.haml.mustache
#content
.left.column
%h2 Welcome to our site!
.right.column
#users
%p
This is nothing new. We've covered the mustache command line utility
before.
What's new is using Mustache to generate Haml, then generating HTML from that Haml:
$ cat example.yml example.haml.mustache | mustache | haml -s
<div id='content'>
<div class='left column'>
<h2>Welcome to our site!</h2>
</div>
<div class='right column'>
<div id='users'>
<p>chris</p>
<p>bob</p>
<p>jones</p>
</div>
</div>
</div>