Playing around with an idea: responsive code.
The build script creates up to 5 versions of each code sample using Prettier, and a container query displays the right one.
Brotli means the filesize overhead is very small.
Live demo: jakearchibald.com/2026/css-cus...
Playing around with an idea: responsive code. The build script creates up to 5 versions of each code sample using Prettier, and a container query displays the right one. Brotli means the filesize overhead is very small. Live demo: jakearchibald.com/2026/css-cus...
0 views
Published on 04/09/2026 13:23
0:09
Playing around with an idea: responsive code.
The build script creates up to 5 versions of each code sample using Prettier, and a container query displays the right one.
Brotli means the filesize overhead is very small.
Live demo: jakearchibald.com/2026/css-cus...
(I'm not sure of the cases when this happens)
this would be awesome for it!
Polypane's source panel has been using Prettier to auto-format HTML sources since I added it a few years ago, to make sure even minified HTML is readable. It's fast enough to run in a worker (at an interval) as well.
polypane.app/docs/source-...
I wanted to add client side code formatting to an internal docs site we had, but didn't want to ship prettier to the client.
In hind sight your approach makes total sense, we don't need to handle arbitrary widths, they bucket very well
➡️ Prettier on the client.
➡️ Diff all the phases, and create chars and line breaks that show & hide at particular widths.
➡️ Nah fuck it just render copies.