如何高效构造指南针 [英] how to construct a compass sass with high efficiency
问题描述
我是指南针无聊的人,我想知道如何高效地构建指南针无聊的项目。 github中是否有任何罗盘Sass框架。或者有经验的开发人员可以建议我如何编写一个好的罗盘萨斯项目。非常感谢。
I am a beginer of compass sass,I want to know how to how to construct a compass sass project with high efficiency. Is there any existed compass sass framework in github . Or can any experienced developer suggest me how to write a good compass sass project .Thank you very much.
推荐答案
各种框架已经移植到可与Compass一起使用的情况,但我不推荐它们。通用的CSS框架构建为千篇一律,因为这是预先设置CSS类列表的最佳选择。使用Sass,您可以构建更具针对性和灵活性的工具,然后使用Compass以独特的方式将它们组合在一起。
Various frameworks have been ported to work with Compass, but I don't recommend them. The common CSS frameworks are built to be one-size-fits-all, because that's the best you can do with a pre-set list of CSS classes. With Sass you can build much more targeted and flexible tools, and then combine them all in unique ways using Compass.
已经有几个与您要问的问题相关的SO问题:
There are several already-answered SO questions that are relevant to what you are asking:
- 在另一个CSS框架中使用Compass / Sass 有关框架的更多信息。
- SASS:使用
@extends
扩展Classess与变量。 - 按元素构造CSS(SASS,LESS)文件,按功能和按媒体查询:3D代码结构?有关组织代码的更多信息。
- Using Compass/Sass with another CSS framework for more on frameworks.
- SASS: Extending Classess vs Variables for more on using
@extends
. - Structuring CSS (SASS, LESS) files by elements, by function and by media queries: 3D code structure? for more on organizing your code.
保持混合和静默类(如%mgb5
)尽可能简单不会失去意义。一般而言,这是一个好规则。 nav
简短但仍易于理解, mgb5
却不多。相同的规则可以指导您进入mixin / class。如果只有一个属性,则mixin / class可能意义不大。如果您有三十岁,那可能意味着它的意义太大了。只要每个混合代表/类代表一个独特而有意义的动作,就可以将较大的混合/类分成较小的类。
Keep mixins and silent classes (like %mgb5
) as simple as possible without losing meaning. It's a good rule for classes in general. nav
is short and still easy to understand, mgb5
is not as much. The same rule can guide you inside the mixin/class. If you only have one property, the mixin/class may not mean much. If you have thirty, it's probably trying to do carry too much meaning. Split larger mixins/classes into smaller ones for more flexibility, as long as each one represents a distinct and meaningful action.
相同的基本准则适用于静态CSS和变量。如果任何规则的目的在普通的CSS中都不明确,那么它应该成为可以为其赋予所需含义的mixin,函数或变量的一部分。如果 18px
刚刚适合您,那么 18px
就可以了。但是,如果 18px
是设置的大小比例的一部分或具有特定用途,则将其命名为: $ large:18px;
或 $ gutter-width:18px;
。
The same basic guidelines apply for static css vs. variables. If any rule has a purpose that isn't clear in the plain css, then it should become part of a mixin, function, or variable that gives it the desired meaning. If 18px
is just a size that seems good to you for now, 18px
is just fine. But if 18px
is part of a set scale of sizes, or has a specific purpose, name it: $large: 18px;
or $gutter-width: 18px;
.
这篇关于如何高效构造指南针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!