Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace nodejs based MJML with rust variant, MRML #8

Open
mrchrisadams opened this issue Jan 26, 2024 · 0 comments
Open

Replace nodejs based MJML with rust variant, MRML #8

mrchrisadams opened this issue Jan 26, 2024 · 0 comments

Comments

@mrchrisadams
Copy link
Contributor

We currently rely on a version of MJML that relies on calling a nodejs binary installed on deployment. you can see it specificed in the base.py:

MJML_CHECK_CMD_ON_STARTUP = True
MJML_PATH = str(PROJECT_DIR / "theme" / "static_src" / "node_modules/.bin/mjml")
MJML_EXEC_CMD = [MJML_PATH, "--config.validationLevel", "skip"]

This can be a bit awkward to work with, and there's a new library, mjml-python, that wraps MRML the rust implementation of the MJML compiler. This means we'd no longer have the dependency on an external node process, and likely would mean writing email ready HTML files from MJML would be faster and more resources efficient

There's an existing issue discussing this in more detail with sample code to use as well?

liminspace/django-mjml#184

The efficiency / performance uplift is pretty impressive - this comment when someone else tried the approach described in the issue was quite eye opening:

Tried @blopker version. Works well so far, and about 100x faster than cmd implementation of django-mjml. 0.006 seconds per render vs 0.9 seconds

Source: Integrate mjml-python? · Issue #184 · liminspace/django-mjml by @github

@mrchrisadams mrchrisadams added this to the Constellate 0.4 milestone Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant