March Docs

Css

Css — inline style helpers for Bastion templates.

Provides Css.style/1 for building CSS style strings from a list of property/value pairs. Used in .march.html templates:

<div style={Css.style([
  ("color", Some(brand_color)),
  ("font-weight", if user.is_admin do Some("bold") else None end)
])}>

Functions

fnstylestyle(pairs : List((String, Option(String)))) : String#

Build a CSS style string from a list of (property, Option(value)) pairs.

Pairs where the value is None are filtered out.  This lets you
conditionally include CSS properties without string gymnastics.

    Css.style([
      ("color", Some("red")),
      ("display", None),
      ("font-size", Some("14px"))
    ])
    -- "color: red; font-size: 14px;"