The build step behind :asset-manifest (since 0.30.0): run by a host's build.clj
before its uberjar, never at run time. It joins the stylesheets a page links into one
file and its scripts into another (since 0.31.0), in the order the shell links them — a
stylesheet minified first — each named by its bytes under the base's /wb/, with a .gz
and a .br beside it when they are smaller, and returns the manifest naming the two,
written as EDN when asked.
It reads each root through :classpath in order, the first entry holding a file
winning, as the JVM would serve it; so a step that rewrites a library's file first —
writes it into :out, which comes first — is joined in its rewritten form. Run it on a
clean :out: a bundle a previous build left there is never served, but it is shipped.
The build step behind `:asset-manifest` (since 0.30.0): run by a host's `build.clj` before its uberjar, never at run time. It joins the stylesheets a page links into one file and its scripts into another (since 0.31.0), in the order the shell links them — a stylesheet minified first — each named by its bytes under the base's `/wb/`, with a `.gz` and a `.br` beside it when they are smaller, and returns the manifest naming the two, written as EDN when asked. It reads each root through `:classpath` in order, the first entry holding a file winning, as the JVM would serve it; so a step that rewrites a library's file first — writes it into `:out`, which comes first — is joined in its rewritten form. Run it on a clean `:out`: a bundle a previous build left there is never served, but it is shipped.
(brotli-bytes brotli bytes timeout-ms)bytes through the brotli program at quality 11, decoded back by the same program
and refused unless they come back whole.
`bytes` through the `brotli` program at quality 11, decoded back by the same program and refused unless they come back whole.
How long one brotli run may take before it is killed: the largest asset of the set
compresses in well under a second, so a run still going after this has hung.
How long one `brotli` run may take before it is killed: the largest asset of the set compresses in well under a second, so a run still going after this has hung.
(gzip-bytes bytes)bytes as gzip at the highest compression, with no name and no time in the header, so
the same bytes always compress the same.
`bytes` as gzip at the highest compression, with no name and no time in the header, so the same bytes always compress the same.
(minify-css css)css without its comments (a /*! … */ stays), its runs of whitespace as one space,
none beside { } ; , nor around a declaration's colon, and no ; before a }.
Strings, unquoted url(…) and escapes pass untouched, and every other space stays: in
calc(1px + 2px) or @media screen and (…) it is part of the meaning. A custom
property's value, or one holding var(), keeps its spaces: an engine keeps it as text.
Judged by real engines against a corpus of traps (test/browser/css-check.mjs); CSS
that is not valid is minified as its own errors allow — an unclosed string still ends
at its line.
`css` without its comments (a `/*! … */` stays), its runs of whitespace as one space,
none beside `{ } ; ,` nor around a declaration's colon, and no `;` before a `}`.
Strings, unquoted `url(…)` and escapes pass untouched, and every other space stays: in
`calc(1px + 2px)` or `@media screen and (…)` it is part of the meaning. A custom
property's value, or one holding `var()`, keeps its spaces: an engine keeps it as text.
Judged by real engines against a corpus of traps (test/browser/css-check.mjs); CSS
that is not valid is minified as its own errors allow — an unclosed string still ends
at its line.(optimise! {:keys [roots classpath out bundles manifest brotli timeout-ms]
:or {brotli "brotli" timeout-ms default-timeout-ms}})Joins the paths :bundles names — {:css [...] :js [...]}, in the order the shell
links them (shell/linked) — into one stylesheet and one script, each read under the
first of :roots ([{:path "/ui/" :root "classpath/prefix"}], the base's own
being assets/base-root) whose path it starts with, through :classpath (directories
and jars, :out first); writes them into :out under the base's root, and answers the
manifest. :manifest, a path under :out, also writes it there as EDN. :brotli names
the program ("brotli" by default), :timeout-ms bounds each run of it.
Before answering it reads back what it wrote — each bundle's bytes against its name and
integrity, a .gz decoded — as the base reads a manifest at boot.
Joins the paths `:bundles` names — `{:css [...] :js [...]}`, in the order the shell
links them (`shell/linked`) — into one stylesheet and one script, each read under the
first of `:roots` (`[{:path "/ui/" :root "classpath/prefix"}]`, the base's own
being `assets/base-root`) whose path it starts with, through `:classpath` (directories
and jars, `:out` first); writes them into `:out` under the base's root, and answers the
manifest. `:manifest`, a path under `:out`, also writes it there as EDN. `:brotli` names
the program ("brotli" by default), `:timeout-ms` bounds each run of it.
Before answering it reads back what it wrote — each bundle's bytes against its name and
integrity, a `.gz` decoded — as the base reads a manifest at boot.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |