This library provides a parser that conforms to CSS Syntax Module Level 3. It parses strings containing CSS stylesheets, and produces an AST conforming to the W3C specs (see https://github.com/astrada/ocaml-css-parser/blob/master/lib/types.mli). The specs are fully implemented, but there are still probably bugs. If your stylesheet doesn’t parse correctly, please open an issue on github.
I wrote this parser as part of ppx_bs_css, but there was some interest in having it as a separate library. So I published it on opam. To install it:
opam install css-parser
Hope you find it useful!