Sass style guide

来源:互联网 发布:检测fps的软件 编辑:程序博客网 时间:2024/06/11 19:17

Syntax

  • Use the .scss syntax, not original .sass indention syntax
  • Order the regular CSS and @include declarations logically

Features

  • Prefer dash-cased variable names (e.g. $my-variable) over camelCase or snake_case variable names.
  • Mixins should apply DRY (Don’t Repeat Yourself). Code with Mixins is as to program with functions. Encapsulation is also a powerful tool here. But pay attention to the styles compiled from mixins because there may be extra codes or conflict styles, which you should avoid
  • Extend directive should be avoided, since it bring potential dangers. Mixins completely provide the function you want from extend
  • Nested selector gives you the feeling that CSS styles are aligned to html template structure though, you Should Never nest selectors more that three levels. Nested selector make your style tightly couple and unreusable.
原创粉丝点击