I use the sails helper method sails.renderView
to render the view in a string, which is then used in email, for example:
sails.renderView('emails/booking', emailData, function (err, view) {
emailService.send(user.email, view);
});
Is it possible to specify a layout file when rendering a view this way? I use the ejs template engine.
It doesn't look like I can use the view ( config/views.js
) configuration as a route.
I looked at the render function in sails/lib/hooks/views/render.js
, and it looked like the layout file to be used could be passed in the options object, but when I did this, the return would not be displayed.
source
share