124 days ago · 19 min read3775 words · Tech · hide · Fediverse post

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…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town