Closed aerosol closed 9 months ago
Hello there! The MRML project has indeed been archived, but that is because the project has been moved to https://github.com/jolimail/mrml-core and https://github.com/jolimail/mrml-cli so rest assured that it is still actively maintained and supported :).
As for when the MJML templates are compiled, mjml_eex
allows you to perform the compilation either at build time or at runtime. When the compilation occurs is up to you and very much depends on the structure of your template. If your template needs to dynamically generate MJML template code...then most likely you will need to do this at runtime since the MJML compiler will need to take that dynamic content into account when generating the final email HTML. Here is an example test to show you how you can configure this: https://github.com/akoutmos/mjml_eex/blob/master/test/mjml_eex_test.exs#L38-L46 as well as some documentation to help you out with configuring this library https://hexdocs.pm/mjml_eex/MjmlEEx.html#module-macro-options
Let me know if that answers your question and feel free to reopen if not :).
Thanks for coming back to me so quickly.
so rest assured that it is still actively maintained and supported :).
I should recall this next time I get insta-discouraged by the "archived" badge. Live and learn.
Indeed I'm looking to dynamically generate MJML sections, implementing a report type of e-mail containing arbitrary number of data rows - this varies per recipient. Perhaps the NIF is a small price to pay...
My usual set up for sending emails with mjml_eex is to have the email sending inside of an Oban job so it happens out of band with whatever request triggered the email to be sent. The Rust NIF is rather quick (usually done in less than a second).
I rarely run with the mode: :compile
flag set since the performance hit is negligible and my templates are usually complex enough that they need to be evaluated at runtime anyways.
Hi, thanks for this library, MJML looks very promising.
I've noticed that https://github.com/jdrouet/mrml has been archived, thus I'm leaning towards the npm cli tool. Regardless, do you think it would be possible to stitch it together so that the actual MJML binary process execution is done only at build-time on the elixir end?
Spawning OS processes under production workload feels sub-optimal and I'm wondering if there's any room for compile-time pipeline. I suppose the biggest issue is the EEx integration, since when you embed EEx markup inside MJML, it'll swallow it:
Do you think there's a way to get around it? I'd be happy to work on a PR.