Macaw.Component.Stylesheet (macaw_component v0.1.2)

Copy Markdown View Source

Generated stylesheets (spec/01 §1.8): CSS a document defines at runtime, served from 'self' at a path addressed by its content, so the same document always yields the same file and base renders capture it.

iex> Macaw.Component.Stylesheet.path(".a{opacity:1}")
"/assets/" <> Base.encode16(:crypto.hash(:sha256, ".a{opacity:1}"), case: :lower) <> ".css"

Summary

Functions

Why a stylesheet can't be served, or nil: :not_a_string, or :origin for an @import or a url( that is not same-origin (a data: URL is allowed in url().

The stylesheet's path: /assets/ and the lowercase SHA-256 of its bytes, .css.

Functions

fault(css)

@spec fault(term()) :: :not_a_string | :origin | nil

Why a stylesheet can't be served, or nil: :not_a_string, or :origin for an @import or a url( that is not same-origin (a data: URL is allowed in url().

path(css)

@spec path(String.t()) :: String.t()

The stylesheet's path: /assets/ and the lowercase SHA-256 of its bytes, .css.