Skip to content

sticksnleaves/bamboo_eex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bamboo.EEx

Build Status

No Phoenix? No problem!

Use Bamboo.EEx to add EEx template support to Bamboo.

Installation

def deps do
  [
    {:bamboo_eex, "~> 0.1.0"}
  ]
end

Examples

defmodule MyApp.Email do
  use Bamboo.EEx, path: "lib/my_app/views"

  def text_and_html_email() do
    new_email()
    |> render_to_html("email.html.eex")
    |> render_to_text("email.text.eex")
  end

  def email_with_assigns(user) do
    new_email()
    |> render_to_html("email.html.eex", user: user)
  end

  def email_with_already_assigned_user(user) do
    new_email()
    |> assign(:user, user)
    |> render_to_html("email.html.eex")
  end
end

Options

When declaring use Bamboo.EEx you can pass in any option that EEx supports.

Consult the EEx documentation for additional details on available options.

Additional Options

:path - the root directory used to find EEx templates