Rule: css extension

Generates a Css.ruleCss.rule given a single CSS rule as string. The %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;display: block; and display: blockdisplay: block are the same.
  • Curly braces aren't allowed. { display: block }{ display: block } isn't valid.