mrml icon indicating copy to clipboard operation
mrml copied to clipboard

Support mj-include tag

Open nacardin opened this issue 5 years ago • 4 comments

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?

nacardin avatar Jul 30 '20 16:07 nacardin

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.

jdrouet avatar May 13 '21 17:05 jdrouet

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?

petejodo avatar Aug 29 '22 23:08 petejodo

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.

drush avatar Dec 14 '22 18:12 drush

that's a good idea. I've to update the library with the latest mjml updates and will work on this 😉

jdrouet avatar Dec 14 '22 22:12 jdrouet

mj-include is now supported

jdrouet avatar Apr 13 '24 13:04 jdrouet