Fork me on GitHub

Why can’t we use Functional CSS and regular CSS at the same time?

本节主要讲述Why can’t we use Functional CSS and regular CSS at the same time?

Why can’t we use Functional CSS and regular CSS at the same time?

我们可以同时使用函数式 CSS 和常规的 CSS 吗?

Harry Nicholls recently wrote all about simplifying styles with functional CSS and you should definitely check it out. In short, functional CSS is another name for atomic CSS or using “helper” or “utility” classes that would just handle padding or margin, background-color or color, for example.

哈里·尼科尔斯最近写的都是 关于简化风格与函数式 css, 你应该绝对看看它。简而言之, 函数式 css 是原子 css 的另一个名称, 或者使用”帮助器” 或 “实用程序” 类, 这些类只会处理填充或边距、背景颜色或颜色等。

Harry completely adores the use of adding multiple classes like this to an element:

harry 很 喜欢在元素中添加这样的多个类:

So what I’m trying to advocate here is taking advantage of the work that others have done in building functional CSS libraries. They’re built on solid foundations in design, people have spent many hours thinking about how these libraries should be built, and what the most useful classes will be

因此, 我在这里要主张的是利用其他人在构建函数式css 库方面所做的工作。它们是建立在坚实的设计基础上的, 人们花了很多时间思考这些库应该如何构建, 以及最有用的类是什么

And it’s not just the classes that are useful, but the fundamental design principles behind Tachyons.

而且有用的不仅仅是类, 还有 tachyons 背后的基本设计原则

This makes a ton of sense to me. However, Chris notes that he hasn’t heard much about the downsides of a functional/atomic CSS approach:

这对我来说很有意义。然而, chris 指出, 他还 没有听说过函数/原子css 方法的缺点