View Source Beacon.Template.HEEx (Beacon v0.2.1)

Handles loading and compilation of HEEx templates.

Summary

Functions

Link to this function

compile(site, path, template, file \\ nil)

View Source

Compile template returning its AST.

Link to this function

compile!(site, path, template, file \\ nil)

View Source
Link to this function

render(site, template, assigns \\ %{})

View Source
@spec render(Beacon.Types.Site.t(), String.t(), map()) :: String.t()

Renders the HEEx template with assigns.

Use only to render isolated templates

This function should not be used to render Page Templates, its purpose is only to render isolated pieces of templates.

Example

iex> Beacon.Template.HEEx.render(:my_site, ~S|<.link patch="/contact" replace={true}><%= @text %></.link>|, %{text: "Book Meeting"})
"<a href="/contact" data-phx-link="patch" data-phx-link-state="replace">Book Meeting</a>"