Last active
June 13, 2020 08:40
-
-
Save nicooprat/d9564d1243d052f0b33a2d222001b2b8 to your computer and use it in GitHub Desktop.
Render HTML from MJML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mjml2html = require('mjml') | |
renderer.renderToString(app, (err, mjml) => { | |
if (err) throw err | |
// Remove illegal MJML attribute added by Vue to avoid warnings | |
mjml = mjml.replace('data-server-rendered="true"', '') | |
// Compile MJML to raw HTML | |
const { html, errors } = mjml2html(mjml) | |
if (err) throw errors | |
console.log(html) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment