Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

MJML (Rust NIFs for Elixir)

Build Status Module Version Hex Docs Total Download License Last Updated

Native Implemented Function (NIF) bindings for the MJML Rust implementation (mrml).


The package can be installed by adding mjml to your list of dependencies in mix.exs:

def deps do
    {:mjml, "~> 1.5.0"}

By default you don't need Rust installed because the lib will try to download a precompiled NIF file. In case you want to force compilation set the MJML_BUILD environment variable to true or 1. Alternatively you can also set the application env in order to force the build:

config :rustler_precompiled, :force_build, mjml: true


Transpile MJML templates to HTML with:

mjml = "<mjml>...</mjml>"
{:ok, html} = Mjml.to_html(mjml)

# For an invalid MJML template:
mjml = "something not MJML"
{:error, message} = Mjml.to_html(mjml)


Available rendering options are:

  • keep_comments – when false, removes comments from the final HTML. Defaults to true.
  • social_icon_path – when given, uses this base path to generate social icon URLs.
mjml = "<mjml>...</mjml>"

opts = [
  keep_comments: false,
  social_icon_path: ""

{:ok, html} = Mjml.to_html(mjml, opts)


We encourage you to contribute to mjml_nif. Please check our guides for more information.

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to our

Copyright and License

Copyright (c) 2020 Paul Götze

This work is free. You can redistribute it and/or modify it under the terms of the MIT License. See the file for more details.