Skip to content

Commit 5bc0cbc

Browse files
committed
Merge pull request airbnb#14 from airbnb/variable-naming
Add section about using dash-cased for variable names
2 parents 0c5513e + 14f444c commit 5bc0cbc

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.scss-lint.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ linters:
1818
LeadingZero:
1919
enabled: false
2020

21+
NameFormat:
22+
enabled: true
23+
24+
PrivateNamingConvention:
25+
enabled: true
26+
prefix: _
27+
2128
PropertySortOrder:
2229
enabled: false
2330

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
1. [Sass](#sass)
1919
- [Syntax](#syntax)
2020
- [Ordering](#ordering-of-property-declarations)
21+
- [Variables](#variables)
2122
- [Mixins](#mixins)
2223
- [Extend directive](#extend-directive)
2324
- [Nested selectors](#nested-selectors)
@@ -240,6 +241,10 @@ Use `0` instead of `none` to specify that a style has no border.
240241
}
241242
```
242243

244+
### Variables
245+
246+
Prefer dash-cased variable names (e.g. `$my-variable`) over camelCased or snake_cased variable names. It is acceptable to prefix variable names that are intended to be used only within the same file with an underscore (e.g. `$_my-variable`).
247+
243248
### Mixins
244249

245250
Mixins should be used to DRY up your code, add clarity, or abstract complexity--in much the same way as well-named functions. Mixins that accept no arguments can be useful for this, but note that if you are not compressing your payload (e.g. gzip), this may contribute to unnecessary code duplication in the resulting styles.

0 commit comments

Comments
 (0)