Rum

All functions are located in the com.biffweb namespace.

(render body)
Renders body with rum/render-static-markup and returns a 200 response.
(unsafe html)
Returns {:dangerouslySetInnerHTML {:__html html}}, for use with Rum.
A Rum data structure for an em dash.
A Rum data structure for an en dash.
A Rum data structure for a non-breaking space.
(g-fonts families)
Returns a link element for requesting families from Google fonts.

For example:
(g-fonts ["Nunito+Sans:wght@900"])
=> [:link {:rel "stylesheet", :href ...}]

base-html

View source
(base-html
 {:base/keys
  [title description lang image icon url canonical font-families head],
  :as opts}
 &
 contents)
Wraps contents in an :html and :body element with various metadata set.

font-families:  A collection of families to request from Google fonts (see g-fonts).
head:           Additional Rum elements to include inside the head.
(form {:keys [hidden], :as opts} & body)
Returns a [:form ...] element.

hidden:  A map from names to values, which will be converted to
         [:input {:type "hidden" ...}] fields.
opts:    Options for the :form element (with hidden removed).

Sets :method to "post" by default, and includes a CSRF token (via
ring.middleware.anti-forgery/*anti-forgery-token*).

export-rum

View source
(export-rum pages dir)
Generate HTML files and write them to a directory.

pages:  A map from paths to Rum data structures, e.g.
        {"/" [:div "hello"]}. Paths that end in / will have index.html
        appended to them.
dir:    A path to the root directory where the files should be saved, e.g.
        "target/resources/public".
Have a question? Join the #biff channel on Clojurians Slack.

Prev
XTDB
Next
Time
Sign up for Biff: The Newsletter
Announcements, blog posts, et cetera et cetera.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.