mrml
mrml copied to clipboard
Support mj-include tag
I would like to be able to reuse template fragments. What do you think about supporting taking in a map of <path, content>, so that mrml wouldn't have to search for the includes at runtime?
Thanks @nacardin for your interest. Regarding your request, this brings a complex things to solve: mrml is supposed to work as a cli, but also in the browser (wasm) so the mj-include should be handled there as well. I'll take a look at this important feature soon and probably integrate it with jolimail.
so just to make sure I understand, you want to be able to support the following?
<mj-include path="./partial.html" type="html"/>
<mj-include path="file://localhost/path/to/partial.html" type="html"/>
<mj-include path="https://example.com/path/to/partial.html" type="html"/>
how do you expect to handle loading files since wasm doesn't support file IO out of curiosity?
Could the first pass at this feature work on the CLI only? WASM support and remote URLs is interesting, but likely a really bad idea from a security standpoint. I think the CLI/includes case is an 80% solution.
that's a good idea. I've to update the library with the latest mjml updates and will work on this 😉
mj-include is now supported