Node.js engine using the ultra fast doT templating with support for layouts, partials and friendly for front-end web libraries (Angular, Ember, Backbone...)
I'd like to switch layout master based on whether the request was made over xhr or directly. I can also imagine someone switching layout based on other information or model state.
I could not find a direct way to do this. What I came up with for the moment is the following
change render and renderSync to pass options directly to template.render()
this requires the express call to be of the form res.render(template,{model:{},layout:{layout:'other.dot'}})
adjust template.render to redefine this.master based on the given layout template.
However, this is not in line with how a model is normally passed on in express template engines.
I'd like to switch layout master based on whether the request was made over xhr or directly. I can also imagine someone switching layout based on other information or model state.
I could not find a direct way to do this. What I came up with for the moment is the following
However, this is not in line with how a model is normally passed on in express template engines.
Any other ideas?