Skip to content

Instantly share code, notes, and snippets.

@delphinpro
Created July 6, 2015 21:14
Show Gist options
  • Select an option

  • Save delphinpro/fc9906baea18dbae9cce to your computer and use it in GitHub Desktop.

Select an option

Save delphinpro/fc9906baea18dbae9cce to your computer and use it in GitHub Desktop.
# SCSS. Style guide
## Formatting
* Four (4) space indents, no tabs.
* 80 character wide columns.
## CSS rules
* Opening brace ({) placement end of line.
* One space before opening brace.
* Closed brace (}) placement on new line.
* Blank line after closed brace.
* No blank line before closed brace.
* One rule in line.
* One space after colon.
* Always semicolor after rule.
* Local variables define before any rules. Separate blank line.
* Call mixins without @content write before all rules.
* Call mixins with @content write after all nested rules.
## Order
* Use always alphabetical order for css-rules in selectors.
## Numbers
* Required leading zero before a deciaml value less than one.
* Zero value shold not be unit.
* Calculations must always be enclosed in parentheses.
* Not use magiс numbers (or explain it in comment).
## Naming
### Variables
* Lowercase, hyphen delimiter words.
$base-font-stack: Arial, sans-serif;
### Constants
* Uppercase, underscore delimiter words.
$CONST_NAME: 10;
### Classes
For naming of classes using BEM-notation. Example:
.block__element_modifier
.super-block__first-element_modifier_value
.main-menu__item_active
In scss-files elements and modifiers define as nested struct. Example:
.main-menu {
// ... rules of block
&__item {
// ... rules for element
&_active {
// ... rules for modified element
}
}
}
So style of block will be defined in one struct.
## Colors
* Hex colors in lowercase
* Short notation if possible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment