Partial include paths in mustache.js

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

It works:

{{>header}} 

It does not mean:

 {{>inc/header}} {{>../header}} 

Any place other than brother does not seem to be matched. This is normal?

+7
source share
1 answer

header , inc/header and ../header are just the key names in the partials object that passed during rendering, which have partial text values

 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 at jsFiddle http://jsfiddle.net/maxbeatty/CWKHe/

+6
source

All Articles