I am including a header.def file in index.dot using {{#def.header}} snippet and rendering the index.dot file using the following snippet.
var dotjs = require('dot');
var dots = dotjs.process({ path: "./views"});
app.get('/',function(request, response){
response.send(dots.index());
});
What I also wish to do is render only the header on separate url. Something like:
app.get('/header',function(request, response){
response.send(dots.header()); // header.def is not compiled to a dot.header function
});
Maybe you can create another .def file (for instance "onlyHead.dot") and include the static header in that one without anything else. Then send onlyHead.dot in the same way as you do.
You could also use the template engine doing something like this:
In main app:
Then in your views you can render it like this (with router.get or as you have it with app.get):
Your index.dot template can then look something like this:
See my answer here