Skip to content

Instantly share code, notes, and snippets.

@zkayser
Last active February 2, 2023 22:39
Show Gist options
  • Save zkayser/6d87f435afcecb32b7838fca28f33fb3 to your computer and use it in GitHub Desktop.
Save zkayser/6d87f435afcecb32b7838fca28f33fb3 to your computer and use it in GitHub Desktop.
Leex/Heex
defmodule SearchLive do
.....STUFF
def render(assigns) do
template_extension = if FeatureFlag.enabled?(), do: ".heex", else: ".leex"
# I can't remember the exact API to directly render a template, but it's something like this:
Phoenix.View.render("search_live.html.#{template_extension}", assigns)
end
end
THEN:
(search_live.html.heex) *just waving my hands here but something like this, assuming `render_ad_card` is a ~H-based render function*
<InventoryAdCard.render_ad_card {@assigns} />
(search_live.html.leex)
<%= live_component InventoryAdCard, ...assigns %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment