Imison.Web.Assets (Imison v0.1.0)

Copy Markdown View Source

Serves the dashboard's stylesheet, fonts and script from Imison itself.

The assets are read at compile time: priv/static/app.css, the WOFF2 fonts in priv/static/fonts/, and one script made of Phoenix's and Phoenix LiveView's own minified JavaScript followed by priv/static/imison.js, which connects the LiveView socket. Their URLs carry a digest of all of them, so they are cached for a year and change whenever an asset does. The stylesheet links its fonts with relative URLs, which resolve next to it.

The routes sit in the host's :browser pipeline, whose CSRF protection refuses JavaScript to <script> tags; the script holds no secrets, so it is served past that check, as Phoenix LiveDashboard serves its own.

Summary

Functions

Returns the URL path of the stylesheet or the script of a dashboard mounted at dashboard_path.

Functions

path(dashboard_path, atom)

@spec path(String.t(), :stylesheet | :script) :: String.t()

Returns the URL path of the stylesheet or the script of a dashboard mounted at dashboard_path.