PhoenixMountable.HTML (PhoenixMountable v0.2.1)

Copy Markdown View Source

Tags for a library's own root layout, usable from any template engine.

These functions return safe HTML, so they work in EEx templates of a library that does not use LiveView as well as in HEEx. LiveView libraries can use the components in PhoenixMountable.Layout instead.

<%= PhoenixMountable.HTML.meta_tags(@mount) %>
<%= PhoenixMountable.HTML.asset_tags(@mount) %>

Summary

Functions

<link> and <script> tags for the mount's asset entries, with the request's CSP nonces and phx-track-static.

The <meta> tags a library's JavaScript reads: the CSRF token, the LiveView socket path and transport, and the mount path (phoenix-mountable-prefix).

Functions

asset_tags(mount, opts \\ [])

@spec asset_tags(PhoenixMountable.Mount.t(), keyword()) :: Phoenix.HTML.safe()

<link> and <script> tags for the mount's asset entries, with the request's CSP nonces and phx-track-static.

Options

  • :only — the entry names to render. Defaults to all.
  • :track_static — add phx-track-static. Defaults to true.

meta_tags(mount)

The <meta> tags a library's JavaScript reads: the CSRF token, the LiveView socket path and transport, and the mount path (phoenix-mountable-prefix).

The browser helper (PhoenixMountable.connect() in JavaScript) reads them.