-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check if it's possible to use mjml-browser package and use it on a browser #52
Comments
Thanks! |
Is there any chance of this happening? |
First of all thank you @mastertheblaster for writing this package! I spent a little time looking into this. It's kinda hard to dynamically substitute So I decided to fork this package and strip away the You can see my Github repo here and I published an npm package @luma-team/mjml-react Here is how the current repo handles serializing to HTML: import { render, Mjml } from 'mjml-react';
const { html, errors } = render((<Mjml>...</Mjml>), mjmlOptions);
// html is now something you can throw into an email Here is how my package serializes to HTML: import { renderToMjml, Mjml } from '@luma-team/mjml-react';
import mjml2html from 'mjml';
// Or you can use 'mjml-browser' here
const mjmlString = renderToMjml(<Mjml>...</Mjml>));
const html = mjml2html(mjmlString);
// html is now something you can throw into an email I like the latter method more because it allows you to choose your own MJML renderer. I'd be happy to continue cleaning up my package if it would be useful for other people. Here are some other things that I think would be nice to change:
|
Thanks for this @vpontis! |
Also @mastertheblaster I'd be happy to merge this in if you would like. Or I can maintain it as a separate package... |
While not documented, all pieces needed to render it on browser are present: https://codesandbox.io/s/agitated-hypatia-9mcjo?file=/src/App.js |
For info, in my case I wanted to have it directly in Storybook without an additional nested
(I think it's fine on the security perspective since Storybook does not manage real data) |
No description provided.
The text was updated successfully, but these errors were encountered: