首页 > 代码库 > Sass之初识
Sass之初识
Sass is the most mature, stable, and powerful professional grade CSS extension language in the world.
SASS是最成熟的,稳定的,和在世界上强大的专业级的CSS扩展语言。
Sass Compatible
Sass的兼容性
Sass is completely compatible with all versions of CSS. We take this compatibility seriously, so that you can seamlessly use any available CSS libraries.
SASS是完全兼容所有版本的CSS。我们控制好这种兼容性,这样就可以无缝地使用任何可用的CSS库。
With either language, you can write your own mixins to help with vendor prefixes. No winner there. But you know how you don‘t go back and update the prefixes you use on all your projects? (You don‘t.) You also won‘t update your handcrafted mixins file. (Probably.)
无论是语言,你可以写你自己的混合来帮助供应商的前缀。没有赢家。但你知道你不去更新你使用你所有的项目的前缀?(你不知道)你也不会更新你的手工混合文件。(可能)。
In Sass, you can use Compass, and Compass will keep itself updated, and thus the prefix situation is handled for you. Bourbon is also good. There will be some back and forth on which of these project is "ahead."
在Sass中,你可以使用指南针,指南针会保持更新,因此前缀情况为你处理。波旁王朝也不错。将有一些来回的这些项目是“领先”。
In LESS, there are also some mixin libraries battling to be the best. They are looking a lot better these days than they have in the past. Despite their marketing-y support charts, I don‘t think they are quite as robust as the Sass versions. I‘ve been led to understand in the past that the language of LESS itself doesn‘t make it possible to build as robust of libraries on top of it. We‘ll get to some of that next.
不,也有一些混合图书馆努力成为最好的。这些天他们看起来比过去好多了。尽管他们的marketing-y支持图表,我不认为他们是很强大的放大版本。我一直在过去的理解,少本身的语言,并不能使它成为强大的库顶部的它。我们会得到一些下一个。
In both cases, the onus is on you to keep the preprocessor software itself up to date as well as these libraries. I also find that easier in Sass in general. For instance, Compass updates will just come automatically in CodeKit, or you use a Gem which is easy to update, while LESS mixins you‘ll have to manually update a file yourself.
在这两种情况下,你有责任保持前处理软件本身目前以及这些库。我还发现,容易在SASS一般。例如,指南针会自动更新来CodeKit,或者你用宝石易于更新,而不混入你必须手动更新文件自己。
LESS has an ability to do "guarded mixins." These are mixins that only take affect when
a certain condition is true. Perhaps you want to set a background color based on the current text color in a module. If the text color is "pretty light" you‘ll probably want a dark background. If it‘s "pretty dark" you‘ll want a light background. So you have a single mixin broke into two parts with these guards that ensure that only one of them takes effect.
少有能力做“守卫混入。”这些都是混合的只考虑影响某个条件为真时。也许您想在模块中设置基于当前文本颜色的背景颜色。如果文本的颜色是“漂亮的光”,你可能会想要一个黑暗的背景。如果它是“非常黑暗”,你会想要一个光背景。所以你有一个单一的混合折成两部分这些警卫,确保只有一个生效。
Sass之初识