Skip to content

Replace nodejs based MJML with rust variant, MRML #8

@mrchrisadams

Description

@mrchrisadams

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions