Skullet.Boot (Skullet v0.1.0)

Copy Markdown View Source

Draws the skeletons already in the server's HTML before the browser's first paint.

Without it, the sample is laid out and hidden from the first paint, but the bars only appear once the engine's bundle has loaded and the LiveView has mounted — a blank box for those few hundred milliseconds. The script measures and draws synchronously, using the same geometry, metrics and shimmer code the engine uses.

Render it once per page, after the markup it measures:

<Skullet.Boot.boot nonce={@nonce} />

It is about 9KB of JavaScript inlined into the page, so it is your call to place it. Being inline, a Content Security Policy needs its nonce — usage has a plug that makes one and carries it into the LiveView.

Summary

Functions

boot(assigns)

@spec boot(map()) :: Phoenix.LiveView.Rendered.t()

Attributes

  • nonce (:string) - the CSP nonce for the inline script. Defaults to nil.