Liking cljdoc? Tell your friends :D

dev.arkaitz.web-base.assets

Bundled assets (since 0.31.0; one fingerprinted file per asset in 0.30.0). A build joins every stylesheet a page links into one file and every script into another, each named by its bytes — /wb/base-<8 hex>.css, /wb/base-<8 hex>.js — and writes a manifest naming them, the integrity of their bytes and the paths each joins, in order:

{:css {:path "/wb/base-3f9a0c1e.css" :integrity "sha256-…" :members ["/wb/wb.css" …]} :js {:path "/wb/base-77d2b4a0.js" :integrity "sha256-…" :members ["/wb/htmx.min.js" …]}}

The host reads that manifest and hands it to wb/handler as :asset-manifest; the base never looks for a file. A bundle's path names its bytes, so it is served immutable, and the shell links the two bundles, each with its integrity, in place of the files they join. The name's eight hex digits are there to be unique, not to be checked: the integrity, the whole SHA-256, is what a browser checks.

Bundled assets (since 0.31.0; one fingerprinted file per asset in 0.30.0). A build joins
every stylesheet a page links into one file and every script into another, each named by
its bytes — `/wb/base-<8 hex>.css`, `/wb/base-<8 hex>.js` — and writes a manifest naming
them, the integrity of their bytes and the paths each joins, in order:

  {:css {:path "/wb/base-3f9a0c1e.css" :integrity "sha256-…" :members ["/wb/wb.css" …]}
   :js  {:path "/wb/base-77d2b4a0.js"  :integrity "sha256-…" :members ["/wb/htmx.min.js" …]}}

The host reads that manifest and hands it to `wb/handler` as `:asset-manifest`; the base
never looks for a file. A bundle's path names its bytes, so it is served `immutable`, and
the shell links the two bundles, each with its `integrity`, in place of the files they
join. The name's eight hex digits are there to be unique, not to be checked: the
`integrity`, the whole SHA-256, is what a browser checks.
raw docstring

base-rootclj

Where the base serves its own files from: /wb/, out of its jar. The bundles are served from it too.

Where the base serves its own files from: `/wb/`, out of its jar. The bundles are
served from it too.
sourceraw docstring

bundle-pathclj

(bundle-path kind fp)

The path the bundle of kind (:css or :js) with fingerprint fp is served at.

The path the bundle of `kind` (`:css` or `:js`) with fingerprint `fp` is served at.
sourceraw docstring

bundle-path?clj

(bundle-path? path)

Whether path has the shape of a bundle's, whichever build wrote it.

Whether `path` has the shape of a bundle's, whichever build wrote it.
sourceraw docstring

check-manifest!clj

(check-manifest! manifest resource-of linked)

Refuses manifest unless it names both bundles, each at a path of a bundle's shape for its kind, whose bytes — read through resource-of, a path to the classpath resource the base serves there or nil — carry that path's fingerprint and the :integrity it gives, with a .gz beside it, when there is one, that decodes to those very bytes; and unless each bundle joins exactly the paths linked ({:css [...] :js [...]}, what the shell links without a manifest) names, in that order — so a manifest whose bundles are not the files beside it, or from a build that left a stylesheet or a script out, refuses to start rather than serve a page without it. What it cannot see is a whole build left over — manifest and bundles together — whose members have changed since: their bytes are not compared, which is why a build starts from a clean class directory. A .br the JDK cannot decode: the build that writes it proves its round trip.

Refuses `manifest` unless it names both bundles, each at a path of a bundle's shape for
its kind, whose bytes — read through `resource-of`, a path to the classpath resource the
base serves there or nil — carry that path's fingerprint and the `:integrity` it gives,
with a `.gz` beside it, when there is one, that decodes to those very bytes; and unless
each bundle joins exactly the paths `linked` (`{:css [...] :js [...]}`, what the shell
links without a manifest) names, in that order — so a manifest whose bundles are not
the files beside it, or from a build that left a stylesheet or a script out, refuses to
start rather than serve a page without it. What it cannot see is a whole build left over
— manifest and bundles together — whose members have changed since: their bytes are not
compared, which is why a build starts from a clean class directory. A `.br` the JDK
cannot decode: the build that writes it proves its round trip.
sourceraw docstring

fingerprintclj

(fingerprint bytes)

The first eight lowercase hex digits of the SHA-256 of bytes: what a bundle's name carries.

The first eight lowercase hex digits of the SHA-256 of `bytes`: what a bundle's name
carries.
sourceraw docstring

integrityclj

(integrity bytes)

The Subresource Integrity of bytes: sha256- and the base64 of their whole SHA-256.

The Subresource Integrity of `bytes`: `sha256-` and the base64 of their whole SHA-256.
sourceraw docstring

kindsclj

The two bundles, and the extension each one's name ends in.

The two bundles, and the extension each one's name ends in.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close