Loading Partials in Mustache

PUBLISHED ON JUL 13, 2014 — IMPORTED FROM TUMBLR, TEXT

This took me a while to put together. Luckily, RTFM helped. By the way, the example is written in Jade, which I compile to HTML [with Mustache braces in place] using a Grunt task.

index.jade has this thing: {{> header}} but it renders to a blank line.

I had the header.mustache file in the same directory (mustache/) as index.mustache [which is the file to which the Jade template compiles]. That directory, however, was not the default location that the grunt-mustache-render task was using. So, in my Gruntfile, I simply added options: {directory: "mustache/"} to the mustache_render task.

And now, index.html renders the header partial. Huzzah!