我们从创建 PostCSS 中学到的经验

12 years ago, we created PostCSS, a CSS automation tool with 400M monthly downloads which is used by Google, Wikipedia, Tailwind, and 38% of developers. In this post, we share what we learned during this long journey maintaining such a popular open source project.

12 年前,我们创建了 PostCSS,这是一个 CSS 自动化工具,每月下载量达 4 亿,被 Google、Wikipedia、Tailwind 以及 38% 的开发者 使用。在这篇文章中,我们分享了在维护这样一个广受欢迎的开源项目过程中学到的经验。

In 2013, I decided I no longer wanted to manually manage vendor prefixes like -webkit- in CSS. At the time, the common solution was to use Sass mixins, but I wanted something more automatic. The best UI is just having your problem solved without any UI. So, I created Autoprefixer, a tool which reads CSS as input and generates new CSS with vendor prefixes.

2013 年,我决定不再手动管理 CSS 中的厂商前缀,如 -webkit-。当时常见的解决方案是使用 Sass 的 mixin,但我想要更自动化的方式。最好的 UI 就是无需任何 UI 就能解决问题。 于是,我创建了 Autoprefixer,一个读取 CSS 并生成带厂商前缀的新 CSS 的工具。

For that project, I needed a CSS parser and API to work with CSS. And I found Rework by TJ Holawaychuk. The first versions of Autoprefixer were based on Rework (the first name was even rework-vendors).

在那个项目中,我需要一个 CSS 解析器和与之交互的 API。我找到了 TJ Holowaychuk 的 Rework。Autoprefixer 的早期版本就是基于 Rework 构建的(最初的名字甚至叫 rework-vendors)。

I quickly found that Rework isn’t enough for Autoprefixer. For instance, I wanted to preserve the original whitespace in CSS to be able to use Autoprefixer as a text editor plugin.

我很快发现 Rework 不足以支撑 Autoprefixer。例如,我想保留 CSS 的原始空白,以便把 Autoprefixer 用作文本编辑器插件

Book a call

Hire Evil Martians

雇佣 Evil Martians

With open-source tools used by millions like PostCSS and Autoprefixer, we've shaped the landscape of frontend development. And we can help you create products that developers love and rely on daily, too!

凭借 PostCSS 和 Autoprefixer 等被数百万开发者使用的开源工具,我们塑造了前端开发的格局。我们也能帮你打造开发者喜爱并日常依赖的产品!

Since TJ decided not to add this feature to Rework, I realized I needed to write my own CSS tooling framework.

由于 TJ 决定不将该功能加入 Rework,我意识到我需要编写自己的 CSS 工具框架。

Lesson −1: Be more cooperative with your big users. At least give them a chance to send you ...

开通本站会员,查看完整译文。

trang chủ - Wiki
Copyright © 2011-2025 iteam. Current version is 2.146.0. UTC+08:00, 2025-08-29 06:47
浙ICP备14020137号-1 $bản đồ khách truy cập$