Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use an alias inside the template? #23

Open
drselump14 opened this issue Jul 30, 2024 · 1 comment
Open

How to use an alias inside the template? #23

drselump14 opened this issue Jul 30, 2024 · 1 comment

Comments

@drselump14
Copy link

Is the elixir alias supported inside the mjml template?
I've tried but always failed. Did I miss something? Any help would be appreciated

@jmillxyz
Copy link

jmillxyz commented Aug 20, 2024

@drselump14 have you tried using the alias before the use MjmlEEx macro line in your email module? I noticed the same thing when I had my alias after.

Example:

# lib/project_web/templates/emails/my_email.ex
defmodule ProjectWeb.Templates.Emails.MyEmail do
  alias ProjectWeb.Templates.Components

  use MjmlEEx,
    mjml_template: "my_email.mjml.eex",
    layout: Components.MyLayout
end
<!-- lib/project_web/templates/emails/my_email.mjml.eex -->
<mj-section>
  <%= render_static_component Components.MyComponent %>
</mj-section>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants