Template does not render handlebar expressions
See original GitHub issueI got server defined like this:
const MailQueue = new MailTime({
db, // MongoDB
type: 'server',
strategy: 'backup', // Transports will be used in round robin chain
transports,
from() {
// To pass spam-filters `from` field should be correctly set
// for each transport, check `transport` object for more options
return "Example <no-reply@example.com>";
},
concatEmails: false, // Concatenate emails to the same addressee
debug: true
});
And client like this:
const MailQueue = new MailTime({
db, // MongoDB
transports,
type: 'client',
debug: true
});
Now I"m sending an email like this:
MailQueue.sendMail({
to: 'example@email.com',
subject: 'You\'ve got an email!',
user: "John",
html: template,
template: "{{{html}}}",
baseUrl: host
})
And I load the template like this:
fs.readFile(process.env.PWD + app.get('templates') + '/email.html', (err, data) => {
if (err) { reject() };
resolve(data.toString());
});
The email sends fine, but the handlebars expressions in the template are not replaced with the opts. What am I doing wrong?
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Handlebars Template is not rendered - Stack Overflow
In this instance, your main.js is trying to use a handlebar method/object that doesn't exist yet, because it gets included/executed after you main.js...
Read more >Expressions | Handlebars
Handlebars expressions are the basic unit of a Handlebars template. You can use them alone in a {{mustache}} , pass them to a...
Read more >Templating With Handlebars Cheatsheet - Codecademy
Handlebar.compile() can be used to produce a templating function. A template string with expressions must be passed into Handlebar.compile() .
Read more >Handlebars.js documentation - DevDocs
Handlebars.js 4.0.12 API documentation with instant search, offline support, keyboard shortcuts, mobile version, and more.
Read more >A Step By Step Guide To Using Handlebars With Your Node js ...
Here's what's going on, Handlebars takes a static template file you give it inside ... By default, if you don't tell handlebars which...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@satyavh Thank you for noticing this issue.
This was fixed and published as
v1.0.0
. Please try it at you end.Feel free to reopen it in case if the issue is still persists on your end.
Marked as [bug], thank you for reporting this. Going to double check it.