Liking cljdoc? Tell your friends :D

dev.arkaitz.web-base.optimise

The build step behind :asset-manifest (since 0.30.0): run by a host's build.clj before its uberjar, never at run time. For every stylesheet and script under the asset roots it is given, it writes the file again under its fingerprinted name — a stylesheet minified first — with a .gz and a .br beside it when they are smaller, and returns the manifest from each served path to its fingerprinted one, 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 optimised in its rewritten form. Run it on a clean :out: a fingerprinted file 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. For every stylesheet and script under the asset
roots it is given, it writes the file again under its fingerprinted name — a stylesheet
minified first — with a `.gz` and a `.br` beside it when they are smaller, and returns
the manifest from each served path to its fingerprinted one, 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 optimised in its rewritten form. Run it on
a clean `:out`: a fingerprinted file a previous build left there is never served, but it
is shipped.
raw docstring

brotli-bytesclj

(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.
sourceraw docstring

default-timeout-msclj

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.
sourceraw docstring

gzip-bytesclj

(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.
sourceraw docstring

minify-cssclj

(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.
sourceraw docstring

optimise!clj

(optimise! {:keys [roots classpath out manifest brotli timeout-ms]
            :or {brotli "brotli" timeout-ms default-timeout-ms}})

Optimises every stylesheet and script under :roots — [{:path "/ui/" :root "classpath/prefix"}], the base's own being assets/base-root — read through :classpath (directories and jars, :out first), into :out, 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 checks its own output as the base checks a manifest at boot.

Optimises every stylesheet and script under `:roots` — `[{:path "/ui/" :root
"classpath/prefix"}]`, the base's own being `assets/base-root` — read through
`:classpath` (directories and jars, `:out` first), into `:out`, 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 checks its own output as the base checks a manifest at boot.
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