Not sure what the endgame is, however phoenix does template compilation and caching out of the box, the only thing that always happens at runtime is template evaluation, which you want to be at runtime.
If you want to render a template at runtime, all you have to do is declare it correctly, this is the code you want to generate:
defmodule MyLiveview do
use Phoenix.LiveView
def render(assigns) do
~H"""
<p>Hello, <%= @name %>!</p>
"""
end
end
This is a generic example, it’s crucial that you use the heex sigil, otherwise you lose critical features of liveview templates, like change tracking.
If you decide to go lower level for whatever reason, it’s up to you to implement everything phoenix liveivew heex engine does for you, which I don’t recommend unless your scope is to use the templating engine for something else besides liveview.


















