← All repos

styled-ppx

styled components for Reason/OCaml with type-safe CSS and static extraction

cssmelangeocamlreasonreasonmlreason-reactrescriptstyledvscode-extension
Browse cluster: OCaml Systems and Utilities
1,969commits
30contributors
9languages

Tech stack & purpose

styled-ppx is a preprocessor extension and library for OCaml and Reason that enables type-safe, compile-time verified CSS-in-code styling for React components and class names, with zero runtime overhead through static extraction. The project is built using OCaml and Reason as its primary languages and targets both Melange and native OCaml environments, with support for ReScript compatibility. The architecture consists of a parser and type checker that builds CSS abstract syntax trees and validates properties, a PPX transformer that exposes styled component macros, runtime emitters for different platforms, and an extraction pipeline that converts styling into static CSS assets during compilation. Editor support is provided through VSCode and Vim extensions, with the VSCode extension created by davesnx and building on prior work by styled-components' team.

Community & reference links

Languages

OCaml
42.8%
Reason
36.5%
JavaScript
9.3%
TypeScript
5.8%
MDX
4.3%
CSS
0.8%
Makefile
0.2%
Shell
0.1%
Dune
0.1%

Contributors