When rendering jade templates in express, you can customize your application using the 'view options', { layout: true }
and the created templates are automatically connected to the local body
template.
I am trying to get equivalent behavior rendering files from node.js, but without an explicit structure (I just create static files as part of a larger pipeline).
There seem to be two options:
- Download both the main template and the layout, convert to functions, first create a template, and then pass the results to the layout function.
- Use standard template inheritance and block structure, but then I explicitly use named blocks
Are these the only options (which, rightly, are still amazing), or did I miss some trick?
Edit
Here's a rough cut of the first option in case anyone is interested:
source share