adoptoposs / mjml_nif

Elixir NIF bindings for the MJML Rust implementation (mrml)
https://hexdocs.pm/mjml
MIT License
122 stars 17 forks source link

unable to load included template #122

Open amin-wan-kenobi opened 9 months ago

amin-wan-kenobi commented 9 months ago

In my mjml template I have mj-include but when I run to_html function, I get unable to load included template error. Here's an example of my template

<mjml>
  <mj-head>
    <mj-include path="./partials/head.mjml" />
  </mj-head>
  <mj-body>
    <mj-include path="./partials/header.mjml" />   
    <mj-wrapper>
      <mj-section>
        <mj-column>
          <mj-text font-size="16px">
           Dear {{ username }},
          </mj-text>
          <mj-text font-size="16px">
           We have received your request
          </mj-text>
        </mj-column>
      </mj-section>
    </mj-wrapper>
    <mj-include path="./partials/simple_footer.mjml" />
  </mj-body>
</mjml>

Any idea how to solve this? I tried replacing the path with the absolute path of the mj-include file but the error persosts.

amin-wan-kenobi commented 9 months ago

For now, I read the partial template and replaced the whole mj-include with it. But I was wondering if there was a better way to solve this matter.