Since mjml4-in-browser is only being used to compile the mjml -> html, I was wondering if there is a way to create an override to the current parse method, to allow users to compile the mjml on the server instead.
something like:
const editor = grapesjs.init({
fromElement: 1,
container : '#gjs',
plugins: ['grapesjs-mjml'],
pluginsOpts: {
'grapesjs-mjml': {
parser: async function (mjml) {
const res = await axios.post("/parser", {
mjml: mjml
})
// this returns the html
return res.data
}
}
}
});
pros:
this way the mjml4-in-browser package could become an optional peerDependency and would probably shave off a lot of the bundle size.
parsing mjml in the browser can be quite heavy, so this should be less stress on the browser
no future problems with running mjml in the browser since it is a node.js package
cons:
parsing delay since you are now depending on network requests, needs error handling.
I don't have any experience with the grapesjs internals so I was just wondering if building something like this is even possible, @artf thoughts?
Hi,
Since
mjml4-in-browser
is only being used to compile themjml
->html
, I was wondering if there is a way to create an override to the current parse method, to allow users to compile themjml
on the server instead.something like:
pros:
mjml4-in-browser
package could become an optionalpeerDependency
and would probably shave off a lot of the bundle size.mjml
in the browser since it is a node.js packagecons:
I don't have any experience with the grapesjs internals so I was just wondering if building something like this is even possible, @artf thoughts?