Thursday, 13 April 2017

jsrender to render template with partials server side in node.js

I can't work out the syntax for including a partial with jsrender in node.js.

I can include the partial as outlined in the documentation.



This can be rendered and send to the browser

res.send(jsr.renderFile('./views/my_view.html'));

What I am trying to achieve is to define the partial inside a tag. I set the tag like so?



And then in node.js extend the renderFile call like so:

res.send(jsr.renderFile('./views/partials/my_partial.html',
  {my_partial : tmpl='./views/partials/my_partial.html'}
));

No error but the include block is sent empty to the browser. :(



via Dennis Bauszus

No comments:

Post a Comment