visionmedia/jade — Issue #419: Accessing blocks or mixin from outside the compiled template
Author: pacovell
Created: 2011-11-28 21:45:32+00:00
State: open

I am using Jade and setting up my own layout processor, and I'd like to access the equivalent of a mixin or a block from the body template so that I can incorporate it into the layout template.

For example:
var body = jade.compile(body)(options.locals);
options.locals.body = body;
fullPage = jade.compile(layout)(options.locals);

If I can extract body's mixin variables, I can put them into locals and then they will render naturally. I don't have any real preference as to how this happens, any ideas about how to do it most easily?

I can pass variables between the two by just setting the variable in the body (- title = 'hello') but I can't figure out how to capture an entire block that way; this would also be a reasonable solution.

Thanks.