I want to pick which jade partial to include by sending the location as a local. Here's what I tried:
app.js:
var express = require('express');
var fs = require('fs');
var app = express();
var jade = require('jade');
app.get('/jadetest', function(req, res){
var fn = jade.compileFile('views/over.jade');
var locals = {"bodystring": "./body.jade"}
res.writeHead(200, {'Content-Type': 'html'});
res.write(fn(locals));
res.end();
})
var server = app.listen(3000);
over.jade:
doctype html
html(lang="en")
head
title= pageTitle
body
h1 Title
// This doesn't work
//include bodystring
// or this
//include #{bodystring}
// or this
//include -bodystring
// this does, but it doesn't offer the flexibility I want
include ./body.jade
body.jade:
h1 Jade - node template engine
I can set the title as the contents of bodystring but it doesn't like it when I put it in an include. Is there a separate syntax for this? Is it possible at all? Am I doing things the hard way?