Live view elixir templates

Hello, let’s say that I prefer to write elixir (content_tag) instead of html, what it would take to ditch leex in favor of ex in live view? Sample template:

html([], [
  header([], [
  body([], [
    div_([class: "container"], [
      div_([], [text "Hello world"])

LiveView does not support change tracking in those functions, so you’re currently required to write templates to benefit from change tracking and the engine being able to split up static from dynamic parts of a template. This is not to say it wouldn’t be possible, but the current engine does not support it.

1 Like

Thank you, I know that it is not supported by default, mi question was more like in the lines with, if you want to work with classic templates, functions need to return {:safe, *}, so im curious that maybe live view have it’s own internal structure format that I could use

LiveView does indeed use a custom format and it’s quite a bit more complex than just {:safe, iodata()}. You can take a look at phoenix_live_view/engine.ex at v0.15.5 · phoenixframework/phoenix_live_view · GitHub if you’re curious.