1 hour ago · 19 min read3775 words · Tech · hide · 0 comments

As discussed in a previous post, I have been working for a while on running Tailwind CSS without a Node.js dependency. That meant porting its CSS generation to OCaml and checking the output against the JavaScript original, byte for byte. Comparing bytes is trivial; explaining a mismatch needed a parser. The parser needed a typed representation of CSS rather than a bag of strings. Once CSS is typed, a structural diff is possible. To avoid noise, the AST first needs a canonical form, and that needs an understanding of the cascade order: a rule only moves where the cascade allows it. With CSS as a typed value, it was tempting to write each optimisation as a pure AST-to-AST rewrite and let the cascade semantics decide which of them are safe: a rewrite is allowed only where it leaves every element's resolved style unchanged. All of that in hand, writing a small CLI wrapper was the next logical step. And so I am happy to announce that I have just released it as cascade 1.0.0, available on…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.