mnot/hinclude — Issue #3: Rendering JSON data
Author: tobiassjosten
Created: 2011-12-29 21:55:16+00:00
State: open

HInclude does a good job of fetching HTML and injecting that into the DOM. This obviously requires the data to be rendered server side. I would like to explore the possibility of extending this with the ability to render data client side.

There are quite a few JavaScript libraries for taking JSON data and render it in HTML. One of my favorite ones is [mustache.js](https://github.com/janl/mustache.js/). It can be extended with [ICanHaz.js](http://icanhazjs.com/) to allow you to define the templates inline in the HTML.

I would love something like this for HInclude, so it can help remove the glue code you need today if you want to fetch JSON and have it rendered in HTML. The following is an example of what it could look like.

Meet our {{count}} members!

{{#members}}

{{name}}

{{/members}}

What do you think of this idea? Would functionality along these lines fit within the scope of HInclude?