Temple.LiveViewEngine (Temple v0.6.0-rc.0) View Source

The Temple LiveView engine makes it possible to use Temple with Phoenix LiveView.

To get started, you will configure Phoenix to use this module for .lexs files.

# config.exs
config :phoenix, :template_engines,
  # this will work for files named like `index.html.lexs`
  # you can enable Elixir syntax highlighting in your editor for this extension
  lexs: Temple.LiveViewEngine

# config/dev.exs
config :your_app, YourAppWeb.Endpoint,
  live_reload: [
    patterns: [
      ~r"lib/myapp_web/(live|views)/.*(ex|exs|lexs)$",
      ~r"lib/myapp_web/templates/.*(eex|exs|lexs)$"
    ]
  ]

# my_app/
#   lib/
#     my_app/
#     my_app_web/
#       live/
#         posts_live/
#           show.ex
#           show.html.lexs

Now you can get started by writing lexs files co-located with your live views and they will be compiled as you would expect.

Link to this section Summary

Link to this section Functions

Callback implementation for Phoenix.Template.Engine.compile/2.