Closed mirkadev closed 5 years ago
I have the same issue, my config was
const handlebarOptions = {
viewEngine: {
partialsDir: path.join(__dirname, '/../templates/partials'),
layoutsDir: path.join(__dirname, '/../templates'),
defaultLayout: false
},
viewPath: path.join(__dirname, '/../templates'),
extName: '.hbs'
};
Looks like the partials with the extension 'hbs' don't work, even though extName is set. When changing the extension to 'handlebars' for the partials, it works.
So, it work:
transporter.use(
'compile',
hbs({
viewPath: resolve(MAIL.TEMPLATE_DIR),
viewEngine: {
partialsDir: resolve(MAIL.TEMPLATE_DIR, 'partials'),
defaultLayout: resolve(MAIL.TEMPLATE_DIR, 'layouts', 'main.hbs'),
extname: '.hbs',
},
extName: '.hbs',
}),
);
So yes it does, basically the difference being the key 'extName' within the viewEngine block is all lower case. Having both of these the same casing would be more consistent, and can prevent simple slip ups.
My viewEngine:
Main.hbs works and tag {{{body}}} inside it too. But if I trying use {{> top }} in main.hbs file, I get error:
The partial top could not be found