← All series

Series contents

Log in to track your progress

  1. 1. Making a site with just the Cowboy web server Episode
  2. 2. Deploying a simple Elixir app with Nanobox Episode
  3. 3. Building a router and handling static assets Episode
  4. 4. A minimal Plug.Conn clone to handle 404s Episode
  5. 5. Adding EEx templates to a Cowboy web server Episode
  6. 6. Catching EEx template errors and displaying them on the page Episode
  7. 7. Putting an Elixir OTP app in our Elixir OTP app Episode
  8. 8. Creating controllers for an Elixir web server Episode
  9. 9. Creating a DSL for our router Episode
  10. 10. Using Elixir macros to simplify our views Episode

Using Elixir macros to simplify our views

This episode is part 7 in the Zero to Framework (building Alchemist Camp) series:

Let's write some macros and make a lean view layer! We split our "kitchen sink controller" into reasonable framework abstractions for controllers and views and then take advantage of this work to create an episode controller for Alchemist.Camp.

(Source code available for premium members)

Update: The var!() is unneeded since we don't need to modify name or assigns outside the macro.

Open standalone page ↗

No Comments