Allows you to write your Processwire template using MJML and get a converted HTML output using MJML API.

PageMjmlToHtml

A module allowing you to write your Processwire template using MJML and get a converted HTML output using MJML API.

Capture d’écran 2021-12-02 à 19 05 54

Modules directory: https://processwire.com/modules/page-mjml-to-html/

Support forum: https://processwire.com/talk/topic/26466-pagemjmltohtml/

About


Created by Mailjet, MJML is a markup language making it a breeze to create newsletters displayed consistently across all email clients.

Write your template using MJML combined with Processwire’s API and this module will automatically convert your code into a working newsletter thanks to their free-to-use Rest API.

Prerequisite


For this module to work you will need to get an API key and paste it in the module’s configuration.

Usage


Once your credentials are validated, select the template(s) in which you’re using the MJML syntax, save and go visualize your pages to see if everything’s good. You will either get error/warning messages or your email properly formatted and ready-to-go.

From there you can copy/paste the raw generated code in an external mailing service or distribute your newsletter using ProMailer.

Features


  • The MJML output is cached to avoid repetitive API calls
    • Not cached if there are errors/warnings
    • Cleared if the page is saved
    • Cleared if the template file has been modified

  • A simple (dumb?) code viewer highlights lines with errors/warnings
  • A button is added to quickly copy the raw code of the generated newsletter
    • Not added if the page is rendered outside of a PageView
    • Only visible to users with the page’s edit permission

  • A shortcut is also added under “View” in the edit page to open the raw code in a new tab
  • Multi-languages support

Capture d’écran 2021-12-02 à 21 21 45

Notes


The code viewer is only shown to superusers. If there’s an error the page will display:

  • Only its title for guests
  • Its title and a message inviting to contact the administrator for editors

If you are using the markup regions output strategy, it might be best to not append files to preserve your MJML markup before calling the MJML API. This option is available in the module’s settings.

If your layout looks weird somehow, try disabling the minification in the options.

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Twitter updates

  • This week ProcessWire 3.0.214 is on the dev branch. Relative to 3.0.213 this version has 16 new commits which include the addition of 3 new pull requests, 6 issue fixes, a new WireNumberTools utility class, and various other improvements. More
    17 March 2023
  • ProcessWire 3.0.213 core updates: This week we’ll look at the new WireSitemapXML module, a new WireNumberTools core class, and a new ability for Fieldtype modules to specify useful ready-to-use configurations when creating new fields. More
    24 February 2023
  • ProcessWire 3.0.212 core updates— More
    17 February 2023

Latest news

  • ProcessWire Weekly #463
    In the 463rd issue of ProcessWire Weekly brings we'll check out the latest weekly update from Ryan, some weekly forum and online highlights, and more. Read on!
    Weekly.pw / 26 March 2023
  • ProcessWire 3.0.213 core updates
    This week we’ll look at the new WireSitemapXML module, a new WireNumberTools core class, and a new ability for Fieldtype modules to specify useful ready-to-use configurations when creating new fields.
    Blog / 24 February 2023
  • Subscribe to weekly ProcessWire news

“I am currently managing a ProcessWire site with 2 million+ pages. It’s admirably fast, and much, much faster than any other CMS we tested.” —Nickie, Web developer