API Reference
Rule (%css)

Rule: css extension

Generates a Css.rule Css.rule given a single CSS rule as string. The %css [%css] extension is useful in combination with the Array API to compose and re-use rules.

Example

let rule: Css.rule = %css("display: block")
let rule: Css.rule = [%css "display: block"];

Features

  • Only single properties are allowed, e.g., color: blue, and multiple declarations, e.g., :hover { color: blue } or color: blue; background-color: red, are not allowed. If you need to use a selector or use more than one rule, use %cx [%cx] instead.
  • The semi-colon in the last position is optional. display: block; and display: block are the same.
  • Curly braces aren't allowed. { display: block } isn't valid.