Liking cljdoc? Tell your friends :D
Clojure only.

dev.arkaitz.web-base.plugin

Plugins: values the host passes under :plugins, merged into its config as data. The base discovers nothing and calls no plugin on its own — a plugin is the same keys a host writes, prepared by a library: routes, sessionless routes, a dictionary, an asset root and its stylesheets, and at most one subject function, login path and session. expand answers the plain config they stand for, and that is all handler builds from, so what a plugin does is inspectable at the REPL.

The rules, each refused at construction and named:

  • :routes are the host's, then each plugin's, in order; a path two of them claim is reitit's conflict, which names both.
  • :sessionless, :assets and :stylesheets are unions; the same path twice is refused (the last two by handler, which checks the host's own too). Stylesheets come in plugin order and the host's last, so the host's cascade wins. A plugin names one asset root, {:path … :root …}; the host's :assets is a vector of them.
  • :i18n :dict: only the locales the host speaks are taken from a plugin's dictionary — :i18n :locales, or the :default-locale alone — so a plugin never adds a language to the site (since 0.12.0). Each plugin owns the keys it brings under each locale, and two plugins bringing one are refused; the host's dictionary is merged over the result, key by key, so any string a plugin ships can be replaced. Every spoken locale is in the result, empty when no plugin speaks it, so its strings fall back as Tempura falls back. :default-locale, :locales and :locale-fn are the host's alone, and a plugin dictionary without a host :default-locale is refused.
  • :subject-fn, :login-path, :session: the host's value wins — an explicit nil is no value — and with none, one plugin may supply it; two are refused.
  • A plugin's routes are top-level siblings of the host's: they carry their own :wb/layouts and :wb/gate, and inherit none of the host's.
Plugins: values the host passes under `:plugins`, merged into its config as data. The
base discovers nothing and calls no plugin on its own — a plugin is the same keys a
host writes, prepared by a library: routes, sessionless routes, a dictionary, an asset
root and its stylesheets, and at most one subject function, login path and session.
`expand` answers the plain config they stand for, and that is all `handler` builds
from, so what a plugin does is inspectable at the REPL.

The rules, each refused at construction and named:
- `:routes` are the host's, then each plugin's, in order; a path two of them claim is
  reitit's conflict, which names both.
- `:sessionless`, `:assets` and `:stylesheets` are unions; the same path twice is
  refused (the last two by `handler`, which checks the host's own too). Stylesheets come
  in plugin order and the host's last, so the host's cascade wins. A plugin names one
  asset root, `{:path … :root …}`; the host's `:assets` is a vector of them.
- `:i18n :dict`: only the locales the host speaks are taken from a plugin's dictionary
  — `:i18n :locales`, or the `:default-locale` alone — so a plugin never adds a
  language to the site (since 0.12.0). Each plugin owns the keys it brings under each
  locale, and two plugins bringing one are refused; the host's dictionary is merged
  over the result, key by key, so any string a plugin ships can be replaced. Every
  spoken locale is in the result, empty when no plugin speaks it, so its strings fall
  back as Tempura falls back. `:default-locale`, `:locales` and `:locale-fn` are the
  host's alone, and a plugin dictionary without a host `:default-locale` is refused.
- `:subject-fn`, `:login-path`, `:session`: the host's value wins — an explicit nil is
  no value — and with none, one plugin may supply it; two are refused.
- A plugin's routes are top-level siblings of the host's: they carry their own
  `:wb/layouts` and `:wb/gate`, and inherit none of the host's.
raw docstring

check-asset!clj

(check-asset! asset where)

An asset root {:path "/name/" :root "classpath/prefix"}, refused naming where: a path of one lower-case segment, never the base's /wb/.

An asset root `{:path "/name/" :root "classpath/prefix"}`, refused naming `where`:
a path of one lower-case segment, never the base's `/wb/`.
sourceraw docstring

expandclj

(expand {:keys [plugins] :as config})

The plain config config stands for, its :plugins merged in by the rules of this namespace and removed. A config without plugins is answered as it came, less the key.

The plain config `config` stands for, its `:plugins` merged in by the rules of this
namespace and removed. A config without plugins is answered as it came, less the key.
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