biff.rum

Convenience functions for Rum (https://github.com/tonsky/rum).

base

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

font-families: A collection of families to request from Google fonts.
head:          Additional Rum elements to include inside the head.

defatoms

macro

(defatoms & kvs)
Convenience macro for defining multiple atoms.

For example:

(defatoms
  foo 1
  bar 2)

=> (def foo (atom 1))
   (def bar (atom 2))

defderivations

macro

(defderivations & kvs)
A convenience macro for rum.core/derived-atom.

Like [[defatoms]], but anything preceded by @ is watched for changes, and the
defined atoms will be kept up-to-date. Atoms are defined with defonce, so if
you change one of the definitions, you'll need to refresh the browser window
for it to take effect.

For example:

(def foo (atom 3))

(defderivations
  bar (+ @foo 2)
  baz (* @foo @bar))

@bar => 5
@baz => 15
(reset! foo 4)
@bar => 6
@baz => 24

endash

export-rum

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

form

(form {:keys [hidden], :as opts} & body)
Returns a form.

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

g-fonts

(g-fonts families)
Returns a link element for requesting families from Google fonts.

mdash

nbsp

render

(render f opts m)(render f opts)
Given a Rum component f, returns a 200 response.

m: If provided, merges this into the response.

unsafe

(unsafe m html)(unsafe html)
Return a map with :dangerouslySetInnerHTML, optionally merged into m.