You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I intend to generate email templates for Mandrill service. They support handlebar syntax so I want my output to include this syntax. Is this possible?
I have dynamic data coming in and based on that data I want to render different components so if I build for production I would expect the output to contain all the HTML needed for those configurations.
{{#if condition === 'A'}}
<p>Some HTLM</p>
{{#else if condition === 'B'}}
<p>Some other HTML</p>
{{/if}}
Basically let the service render whatever they need.
At the moment I'm using config.js file to configure some variables so I can test it on localhost but for production I'd like to have placeholders in place instead of rendered HTML.
Is there a way to automate this process? Is this supported? Thank you,
Thank you. I'm inexperienced with HTML emails so I think I'm just beginning to understand what I need to do.
My issue is I have dynamic variable state that is enum with 5 different values. In production this value will be sent over API so I can't statically precompile the template and instead I have to rely on Mailchimp's Handlebar support.
The problem is I use <switch> which doesn't really have Handlebar equivalent.
What I ended up doing was:
Extract as much possible into <component> so I don't have to duplicate HTML.
In dev I can just pass some value and use <switch> to preview.
In prod I used <if condition="page.env === 'production'">
When compiling for prod I provide different block that looks like this
The production template is then outputed with prerender components for each case with Handlebar conditionals wrapped around them. I haven't yet tried it but it seems like it could work.
I can't think of better way of doing this. If my enum becomes too large, then it's quite unfeasible to deal with this logic in email template and perhaps rendering the HTML elsewhere and passing it to the template makes more sense.
This discussion was converted from issue #794 on October 12, 2022 14:25.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I intend to generate email templates for Mandrill service. They support handlebar syntax so I want my output to include this syntax. Is this possible?
I have dynamic data coming in and based on that data I want to render different components so if I build for production I would expect the output to contain all the HTML needed for those configurations.
Basically let the service render whatever they need.
At the moment I'm using
config.js
file to configure some variables so I can test it on localhost but for production I'd like to have placeholders in place instead of rendered HTML.Is there a way to automate this process? Is this supported? Thank you,
Beta Was this translation helpful? Give feedback.
All reactions