Skip to content

Instantly share code, notes, and snippets.

@stephenmelrose
Created July 14, 2012 18:45
Show Gist options
  • Save stephenmelrose/3112637 to your computer and use it in GitHub Desktop.
Save stephenmelrose/3112637 to your computer and use it in GitHub Desktop.
Hogan and Partials
var hogan = require('hogan.js');
var partial = hogan.compile('{{#list}}{{foo}}{{/list}}');
var template = hogan.compile('{{> somelist}}');
var result = template.render(
{
list: [
{ foo: 'bar1' },
{ foo: 'bar2' },
{ foo: 'bar3' }
]
},
{ somelist: partial }
);
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment