wilsonpage wilsonpage - 6 months ago 24x
Javascript Question

Partial include paths in mustache.js

I am trying to include a partial inside my template from within a directory.

This works:


This doesn't:



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);


See here on jsFiddle http://jsfiddle.net/maxbeatty/CWKHe/