I am trying to include a partial inside my template from within a directory.
This works:
{{>header}}
This doesn't:
{{>inc/header}}
{{>../header}}
Any location other than a sibling doesn't seem to be picked up. Is this normal?
header
, inc/header
, and ../header
are just names of keys in the partials object passed in at rendering time that have values of the partial text
var tmpl = "{{>header}} {{>inc/header}} {{>../header}}",
data = {},
partials = {
header : "<header>example</header>",
'inc/header' : "<header>xmpl</header>",
'../header' : "whatever"
},
html = Mustache.render(tmpl, data, partials);
document.write(html);
See here on jsFiddle http://jsfiddle.net/maxbeatty/CWKHe/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With