Possibility to write RAW code for template engines #929
-
I'm looking this project since I love react and offer my team a possibility to increase development of email. But in our stack we need to delivery some html files with Handlebars code. {{#if author}}
<h1>{{firstName}} {{lastName}}</h1>
{{/if}} And in this tool I want to type {{#if author}}
<Button>{{ author }}</Button>
{{/if}} That because our backend parse email with python + handlebar and fill the data coming from a database Is there a method to do that? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You can create a component — like someone else from the community mentioned he did — and inside them do what you need to through stuff like: function If(props) {
return <>
{'{{#if author}}'}
<Button>{'{{ author }}'}</Button>
{'{{/if}}'}
</>;
} Might seem a bit confusing at first, but that's the way it is with how things are right now. There is no other way unless you run Node along side your server, and render the emails on demand like they are meant to be rendered. |
Beta Was this translation helpful? Give feedback.
If you want an example of rendering the email with Node by, for example, calling it on the terminal, I made a repository that might be helpful:
https://github.com/gabrielmfern/externalized-rendering-example