Open jamauro opened 4 years ago
Well I guess it should be pretty easy to write a svelte preprocessor that compiles mjml to html in your templates, did you try to do so yet? This way you could use mjml in your mail templates like this:
<script>
let greeting = 'Hello World';
</script>
<template lang="mjml">
<mjml>
<mj-body>
<mj-section>
<mj-column>
<mj-text>
{greeting}
</mj-text>
</mj-column>
</mj-section>
</mj-body>
</mjml>
</template>
Untested, I just copied over the example from mjml's readme.
If you'd implement such a preprocessor, I'd be happy to test it with svelte-mail
😀
Anyway, mjml already does a lot of the transformations I do, e.g. the inlining of styles. Does it even make sense to use both tools / what's you use case?
@LukasHechenberger how would we pass the preprocessor option to the renderMail
function? Or is it taken care of automatically for us if we have a svelte.config.js
somehow?
Asking because I'm running into a similar situation where we have the mailers written already in mjml and we're moving to Sveltekit and we would like to know how we can do this. We have a rough idea/draft for the processor which is really simple but should work.
You pass compiled components to this package, so you can preprocess them as usual e.g. using the svelte rollup plugin.
I guess this blog might be of help here https://escape.tech/blog/sveltemails/
Would be great to use this with https://github.com/mjmlio/mjml. Is it possible?