Closed romainyakarouler closed 8 years ago
That's a point, but allowing multiple template languages would be heavy right? Maybe we could implement a preprocessor in another repo like mjml-hbs
Hi @romainyakarouler,
In my opinion, the role of MJML is to render a responsive HTML email layout. That said, for your use-case, I would recommend to wrap all the handlebars templating tags with an mj-raw
tag so the engine keep them when rendering the MJML.
Once you have the HTML code, you can pass it to handlebar, with the right execution context so it outputs an HTML ready to be sent.
Does it make sense to you? Hope I haven't missed something here!
Let us know how that works for you!
Would it be necessary to wrap those handlebar tags in mj-raw
to even keep them in the final output? I would expect those to be treated as verbatim text, but perhaps this is not possible as you say? What about non mj
tags like <h1>
, do we need to wrap them as well? Ideally, allowing some basic tags would make sense.
@fabien, yes, for now it is a known limitation of our engine. Because of the way we parse the DOM, we need a tag to wrap even basic text/HTML element/tags. This is actually the main reason why we needed to introduce such tag. That said, this is obviously something we're aiming to improve in a near future.
Keep you posted on our progress here!
Hey @romainyakarouler, did my comment help you moving forward on your issue? Thanks!
@arnaudbreton would be nice to have an example for the mj-raw to wow the users right away. currently the documentation seems very minimal
Also worth noting that <mj-raw>
tags (apparently) need to be inside either <mj-head>
or <mj-body>
.
preprocessors can handle this now https://thoughtbot.com/blog/building-templated-emails-with-mjml though the vscode extension is not supporting this style yet.
I've added a PR to address this, but in the meantime have published a forked version with that feature enabled: https://marketplace.visualstudio.com/items?itemName=IvanKeirn.vscode-mjml-custom-path
Hello,
Mandrill and Mailchimp support Handlebars template syntax, could we imagine a command like
mjml -r template.mjml -o template.html --syntax=handlebars
ormjml -r template.mjml -o template.html --syntax=mailchimp
?Example:
Links:
Thank u, Mjml is great!