Static GitHub Issues

[2666] Can't use pug render

prev: Can't load svg from dynamic src
next: Fetch is fired after redirect in middleware

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?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2320">#c2320</a>)</em></sub></div>