首页›Julia Evans›文章

Moving away from Tailwind, and learning to structure my CSS

Julia Evans · 2026年5月15日

AI 摘要 AI 生成,可能有误

作者描述了将他们的几个小型网站从 Tailwind CSS 迁移到语义化 HTML 加原生 CSS 的过程,并解释了 Tailwind 曾教会他们的一些实用体系(重置样式、调色板、字号比例、工具类),他们在围绕组件、基础样式、间距规范、灵活的网格布局以及 esbuild 重构 CSS 的过程中对这些体系加以改造利用。他们列举了放弃 Tailwind 的原因,包括它对构建系统的依赖日益增加、他们自身 CSS 技能的提升、Tailwind 在实现非常规设计时的局限性,以及维护混合代码库的痛苦。最后,他们反思了如何学会尊重 CSS,将其视为一项真正困难而强大的技术,而不是贬低它,并提到了一些他们希望探索的现代特性,例如 @layer、@scope、容器查询和子网格(subgrid)。

Hello! 8 years ago, I wrote excitedly about discovering Tailwind.

At that time I really had no idea how to structure my CSS code and given the choice between a pile of complete chaos and Tailwind, I was really happy to choose Tailwind. It helped me make a lot of tiny sites!

I spent the last week or so migrating a couple of sites away from Tailwind and towards more semantic HTML + vanilla CSS, and it was SO fun and SO interesting, so here are some things I learned!

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Julia Evans

Replacing the old battery on rechargeable bike lights

AI 摘要The author repaired their decade-old rechargeable bike lights, which only held a charge for about 5 minutes, by replacing the lithium coin cell batteries (identified as LIR2477 with the help of an LLM). Following a desoldering guide and friends' advice, they removed the old batteries at a local queer makerspace, ordered replacements and silicone glue from AliExpress, soldered in the new batteries, and glued the lights back together. The repair succeeded—the lights now work for nighttime biking—and cost about $20 CAD total, which the author found rewarding despite having minimal electronics experience.

Some more things about Django I've been enjoying

AI 摘要The author describes learning to build backend-rendered websites with Django in a '2010 style' after years of frontend-heavy approaches, and highlights features they enjoy like query builders, template filters (especially `querystring`), and automatic database migrations. They dislike organizing views with inheritance, preferring function-based code instead, and are still figuring out how to reason about Django performance—notably discovering they had accidentally disabled the cached template loader, whose re-enablement significantly improved the site's request throughput.

Learning a few things about running SQLite

AI 摘要The author shares lessons learned from using SQLite as the database for a Django site, including how running ANALYZE dramatically sped up a slow full-text search query and how long-running cleanup DELETEs can cause other workers to time out and crash since SQLite allows only one writer at a time. They also describe their backup approaches using restic and Litestream, along with tricks like splitting tables across multiple database files. Despite these challenges, they find SQLite works well for small sites, though the experience has given them more appreciation for databases like Postgres.

Links to CSS colour palettes

AI 摘要After deciding to stop using Tailwind CSS for new projects, the author missed its convenient color palette and asked on Mastodon for alternatives. This post compiles links to their favorite palettes (such as uchū, flexoki, and reasonable colours) as well as other palettes, color palette generators, and color tools like colorhexa and oklch resources.

Testing Vue components in the browser

AI 摘要The author describes their approach to end-to-end testing of Vue components entirely in the browser without Node.js, using QUnit along with a custom mountComponent helper, SQL-based fixture data reset via a dev server endpoint, and a polling waitFor function to handle asynchronous rendering. They share practical challenges encountered along the way, such as identifying the right DOM conditions to wait for, dispatching the proper events when filling out forms, adding CSS classes for test targeting, and using Chrome's built-in code coverage tool. The experiment was enjoyable and left the author considering Testing Library and how to eventually integrate browser-based tests into CI.