I use handlebars for my site with the default layout views/, views/layouts/, views/partials/. now I want to use it for mails and I've created a views/mail/ - however, I want to share partials. so I have it configured like this:
var hbs = require('nodemailer-express-handlebars');
var mail = smtp.createTransport(...);
mail.use('compile', hbs({extName: '.html', viewPath: 'views/mail', viewEngine: {partialsDir: 'views/partials'}});
but when I try to use a template, I get an error:
Unhandled rejection Error: The partial Test could not be found
at Object.invokePartial (/Users/ekkis/xx/www/node_modules/handlebars/dist/cjs/handlebars/runtime.js:266:11)
at Object.invokePartialWrapper as invokePartial
at Object.eval (eval at createFunctionContext (/Users/ekkis/xx/www/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), :10:28)
at main (/Users/ekkis/xx/www/node_modules/handlebars/dist/cjs/handlebars/runtime.js:173:32)
at ret (/Users/ekkis/xx/www/node_modules/handlebars/dist/cjs/handlebars/runtime.js:176:12)
at ret (/Users/ekkis/xx/www/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:525:21)
at ExpressHandlebars._renderTemplate (/Users/ekkis/xx/www/node_modules/express-handlebars/lib/express-handlebars.js:247:12)
at ExpressHandlebars. (/Users/ekkis/xx/www/node_modules/express-handlebars/lib/express-handlebars.js:173:21)
I use handlebars for my site with the default layout views/, views/layouts/, views/partials/. now I want to use it for mails and I've created a views/mail/ - however, I want to share partials. so I have it configured like this:
but when I try to use a template, I get an error:
what am I doing wrong?