Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 816 Bytes

README.md

File metadata and controls

32 lines (26 loc) · 816 Bytes

Jinja2 MJML

Micro-package that integrates MJML with Jinja2.

Under the hood it uses mjml_python package, that is a wrapper around rust port of MJML.

Example

from jinja2_mjml import Environment

# MJMLEnvironment it's thin wrapper around jinja2.Environment,
# so you can use all the features of Jinja2 package.
environment = Environment()
template = environment.from_string('''
    <mjml>
      <mj-body>
        <mj-section>
          <mj-column>
            <mj-text>Hello {{ name }}!</mj-text>
          </mj-column>
        </mj-section>
      </mj-body>
    </mjml>
''')

# Render MJML template to HTML
print(template.render(name='MJML'))