2 hours ago · Tech · 0 comments

Tailwind CSS introduced a clever way to manage the HTML/CSS split: encode CSS properties as class names. This solves a recurrent friction in large codebases: keeping HTML and CSS in sync. Tailwind's build scans the source and generates exactly the classes needed to style it. You can (mostly) copy-paste an HTML snippet anywhere and its stylesheet follows. As in other domains, referential transparency is a really nice property, and helps programmers (and designers!) make fewer mistakes, especially when eagerly refactoring a codebase. However, scanning HTML snippets comes with downsides. When the HTML is generated (either statically by a blog engine, or dynamically with browser apps), the strategy falls short. Tailwind proposes various strategies to overcome this (like embedding static CSS classes in its config file), but I don't find them very helpful when I'm developing in OCaml. So six months ago I started reimplementing Tailwind in OCaml. tw began life targeting v3, where classes…

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