mjmlio / mjml

MJML: the only framework that makes responsive-email easy
https://mjml.io
MIT License
17.02k stars 959 forks source link

How can I use mjml parser for template building editors #1063

Closed anand-gopinath closed 6 years ago

anand-gopinath commented 6 years ago

Hi @ngarnier

We are using Grapesjs https://github.com/artf/grapesjs-mjml as a template builder which uses MJML parser to convert MJML code into HTML code. It uses v3.3.5 and recently I upgraded to "version4.0-beta" for the efficient parser functionalities. But it throws some error which I already discussed at #928.

The demo link http://grapesjs.com/demo-mjml.html

My aim is to develop responsive email using MJML with the help of this editor.

When we start to drag and drop some elements into the canvas, it will convert the MJML code to HTML code and render into the editor. Its calling mjml2html parser for this process, where that has been bundled into client side as a minified file https://github.com/artf/grapesjs-mjml/blob/master/dist/grapesjs-mjml.min.js (it is heavy in size and i'm bothering the load time as well in the browser)

So, The questions are

  1. Why this code import { mjml2html } from 'mjml'; was working fine with lower version and not in higher version?
  2. Using the same version3.3.5 - Is all converted HTML code will work fine in major email clients or not?
  3. Do have any other approaches to achieve this without client-side library loading?
  4. Is my aim to achieve this is possible with Grapejs editor?

Thanks in Advance

ngarnier commented 6 years ago

hello @anand-gopinath,

  1. mjml2html is now the default exported function, so you don't need the brackets anymore (documented here)
  2. Yes, the HTML produced with v3.3.5 was already working in all major email clients
  3. You should rather use MJML server-side. You can either host your own api (quite easy to do, here is an example that can even be simplified), use a lambda function or the MJML API
  4. I don't see why it wouldn't be, but I don't know much about the Grapejs editor so you should rather ask its creator who knows it better than anyone

If you're interested, we have an advanced responsive email builder that can be embedded into third-party apps, happy to chat about it.

Cheers!

Amandeepsinghghai commented 5 years ago

@ngarnier Hi, just wanted to know more about the email builder? Could you point me in the right direction?

ngarnier commented 5 years ago

@Amandeepsinghghai you can try it here: https://www.mailjet.com/demo/. If you're interested in embedding it inside your app, you can provide some info about your use case and request a quote here: https://hello.mailjet.com/en-demo/ (note this is an enterprise feature).