CSS Zen Garden 的梦想,终于实现了
The CSS Zen Garden dream, finally shipped

原始链接: https://josprague.com/blog/the-css-zen-garden-dream-finally-shipped/

Firefox.com 的重建是网页开发领域的一个里程碑,它最终实现了“CSS 禅意花园”(CSS Zen Garden)所追求的那种简洁、原生的设计理想。通过与 Mozilla 和 Lincoln Loop 的合作,开发团队放弃了复杂的预处理器,转而拥抱现代的原生 CSS。 得益于 CSS 变量(自定义属性)、Flexbox 和 Grid 等原生特性,团队构建了一个包含 70 多个组件和 25 个页面模板的健壮设计系统。这使得内容团队能够在无需工程团队持续介入的情况下,轻松管理 19 种语言版本。虽然项目使用了一个极简的 PostCSS 步骤来内联导入以提升性能,但其源代码始终保持为纯粹的浏览器原生 CSS,避免了现代构建工具通常所要求的“方言”。 该项目证明了网页平台已经足够成熟,足以在没有冗余架构层的情况下支持复杂且易于维护的设计系统。它强调了回归浏览器原生能力的趋势,确保设计决策能够直接转化为生产环境的结果。归根结底,这种方法推崇一种“正确”且“简便”的构建流程,从而为开发团队实现长期的系统一致性和开发速度。

Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 CSS Zen Garden 的梦想实现了 (josprague.com) 19 分,由 yosito 发布于 1 小时前 | 隐藏 | 过往 | 收藏 | 4 条评论 | 帮助 kreetx 1 小时前 | 下一条 [–] 该网站仍然在线 https://www.csszengarden.com,设计选集在这里 https://www.csszengarden.com/pages/alldesigns/ :)。 回复 yosito 1 小时前 | 父评论 | 下一条 [–] 是的!谢谢。我在我的文章中也链接了这个网站。对于任何正在学习 CSS 的人来说,这都是一个很好的资源。 回复 muglug 10 分钟前 | 上一条 | 下一条 [–] > 有一个诚实的脚注。 我厌倦了人工智能生成的文字。 回复 defenestration 4 分钟前 | 父评论 | 下一条 [–] 真是可惜。花了那么多时间去实现 CSS 的梦想(整洁、深思熟虑),结果却用 AI 生成的套话来与世界分享它。 回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Rebuilding Firefox.com with Mozilla and Lincoln Loop on modern, native CSS with no preprocessors, and what that means for design systems today.

Back in 2008, fresh out of college, I discovered CSS Zen Garden, Dave Shea’s project where one HTML file could be restyled into something completely different using nothing but CSS. It was a glimpse of the dream: clean, reusable design, fully separated from content.

Then you tried to ship real client work, and the dream fell apart. There were no CSS variables. The properties available couldn’t express a full-fidelity design, so we leaned on server-side processing, images, table-based layouts, and endless hacks. Every browser rendered things differently, so much of the work was just making one design behave across all of them. Zen Garden showed what was possible in theory. Production was another story.

That gap took the better part of two decades to close, and most of the closing happened in the last few years. Custom properties gave us variables the browser understands. Grid and Flexbox gave us layout that doesn’t fight the medium. The properties we lacked in 2008 now exist, and they’re implemented consistently enough that you can design against them instead of around them.

Firefox.com

That gap is finally closed. Modern CSS now does natively what we used to need preprocessors and hacks for. On the rebuild of Firefox.com, working with Mozilla and the team at Lincoln Loop, I built the whole system in modern, native CSS with no preprocessors. Custom properties are exported straight from design files, native CSS is written once with no hacks, and it works in every modern browser, with a minimal branded stylesheet giving legacy browsers basic, accessible branding.

Together we built a design system of more than 70 components and 25 page templates, implemented as Wagtail components so the site’s content team can assemble pages without engineering help. The site currently supports 19 locales.

There’s one honest footnote. We did end up with PostCSS in production, used for a single job: inlining @import statements. Native @import still has terrible performance characteristics in some browsers, and on a site like this one that matters more than architectural purity. The authored CSS is still plain, native CSS. Nothing in it depends on a build step to be valid or to make sense. The build only flattens what the browser would otherwise fetch serially.

That distinction is worth keeping in mind when someone tells you a project is “no build step.” What matters is whether the source you write is the language the browser speaks, or a dialect that only exists until compilation.

Why this mattered to me

The Zen Garden dream, finally realized in production. Doing that with Mozilla, one of the leaders of web standards, meant a lot. Firefox.com is a site about the browser, made by the organization that spent 20 years arguing for the platform being used to build it. It’s hard to think of a better place to find out whether the platform is really ready.

It is.

I owe a debt to the people who shaped how I think about this craft: Nicole Sullivan, Rachel Andrew, Jen Simmons, Chris Coyier, Kasey Kelly, who connected me to the Mozilla project, and Eric Meyer, my hometown hero. Their work taught a whole generation of us to think about CSS as a system.

The thread

This is the thread running through all my work: design systems that let teams move fast and stay consistent, whether the building blocks are pure CSS, Tailwind, or shadcn/ui. The tools change every few years. What doesn’t change is the value of a system where the right thing to do is also the easy thing to do, and where a designer’s decision travels to production without being translated three times along the way.

If your team is rethinking its front-end foundation, get in touch.

联系我们 contact @ memedata.com