Faire / mjml-react

React component library to generate the HTML emails on the fly
https://www.npmjs.com/package/@faire/mjml-react
MIT License
375 stars 16 forks source link

Fix whitespace removal from minification #112

Closed thorjarhun closed 4 months ago

thorjarhun commented 4 months ago

Minification is turning <mj-text>Label:</mj-text><mj-text> Value<br></mj-text> into <mj-text>Label:</mj-text><mj-text>Value<br></mj-text>

emmclaughlin commented 4 months ago

Hi @thorjarhun, we actually recommend in the setup that you write your own render function. It is just a two step process of renderToMjml (react -> mjml) and then mjml2html (mjml -> html). You then have full freedom to minify the HTML however best suits your application.

We kept the render function here for backwards compatibility with v2 and as an example. We don't want mjml-react to be opinionated on what html minification options are used moving forward in v3 and beyond.

Let me know if more details would be helpful around that and I am happy to update the README with feedback from you. However, I hesitate to merge this because it is possible there are other people currently relying on the existing minificaiton.

thorjarhun commented 4 months ago

Excellent points! Thank you for your thoughtful consideration!