Skip to main content

Server side render

Register plugins (If you need these plugins)

PluginManager.registerPlugins([Countdown, Shopwindow]);

Register custom blocks

BlockManager.registerBlocks([DynamicCustomBlock]);
const main = async () => {
await EditorCore.auth(process.env.CLIENT_ID!);

const pageData = template.content as EmailTemplate["content"];

// mjmlSkeleton & htmlSkeleton can be cached
const mjmlSkeleton = EditorCore.toMJML({
element: pageData,
mode: "production",
});
const htmlSkeleton = mjml(mjmlSkeleton).html;

const finalHtml = PluginManager.renderWithData(htmlSkeleton, {});

console.log(finalHtml);
};

main();