Home

Issue: 2666

Can't use pug render

[issue link]

Hello,
I’ld like to use pug render function to generate mails templates on my app (I use nuxt + express template). Unfortunately, someting like this doesn’t work:

const pug = require('pug');
(...)

template = 'mails/' + mail.template + '.pug';

await pug.render(template, mail.params, function (err, html) {
    data.html = html;
});

template = 'mails/' + mail.template + '_txt.pug';
await pug.render(template, mail.params, function (err, html) {
    data.txt = html;
});

In result, I have only strange “code”:

<mails/><mail_template_name class="pug"></mail_template_name>

How can I use pug to generate content?

This question is available on Nuxt.js community (#c2320)