You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
@@ -2,7 +2,7 @@ This document outlines the way Customer Success team is expected to write their
2
2
3
3
# Philosophy
4
4
5
-
The Customer Success team uses the SCSS syntax. If you're not familiar with SASS/SCSS, you should take the time to read up on the documentation before you dive into our styles.
5
+
The Customer Success team uses the SCSS syntax. If you're not familiar with Sass/SCSS, you should take the time to read up on the documentation before you dive into our styles.
6
6
7
7
We strive to write extremely modular, object-oriented CSS that will work in as many situations as possible. We also know that sometimes our clients' markup does not allow for this. With those two things in mind, we've come up with a strategy for writing CSS that will help us write faster and better the first time while still being maintainable for new people entering a project.
8
8
@@ -24,18 +24,26 @@ The first thing you'll notice when going through Customer Success's CSS is that
24
24
## Format
25
25
Please use consistent formatting following these rules:
26
26
* One selector per line
27
+
* Use hyphenated lowercase for selector names
27
28
* Use a soft indent of four spaces
28
-
* Use one space between selector and first bracket
29
-
* Use one space between property and value after :
29
+
* Use one space between the selector and opening brace of a declaration block
30
+
* Use no space between property and :
31
+
* Use one space after the colon in a property declaration
30
32
* Always add a semicolon after property value
31
33
* Use single quotes
32
-
* Do not specify units for a zero value
34
+
* Always use quotes around urls
35
+
* Do not specify units on a value of zero
36
+
* Omit leading zeros for decimals in the range 0..1, i.e. prefer .5 over 0.5
37
+
* Avoid selectors with more than three levels, e.g. `ul > li > a` is OK, but `ul > li > a > span` is not (except when targeting client markup).
33
38
* Include a space after each comma in a comma separated property list
34
39
* User lowercase and shorthand hex values, e.g., #aaa
35
-
* Always use hex values unless you are declaring rgba.
36
-
*Separate each ruleset by an empty line
40
+
* Always use hex values unless you are declaring rgba or hsla.
41
+
*Don’t pad parentheses with whitespace, e.g. `linear-gradient(to bottom, #fff, #000)`, not `linear-gradient( to bottom, #fff, #000 )`.
37
42
* Separate each declaration block by an empty line
43
+
* Separate each rule group by an empty line (see examples)
38
44
* Use // for comment blocks (instead of /**/)
45
+
* Place Sass `@else` statements on the same line as the closing brace of the preceding `@if`.
46
+
* Always include a blank newline at the end of files.
39
47
40
48
```scss
41
49
.x-selector1,
@@ -50,98 +58,129 @@ Please use consistent formatting following these rules:
50
58
.x-selector-a,
51
59
.x-selector-b {
52
60
padding: 10px;
53
-
background: rgba(255, 255, 255, 0.25);
61
+
background: rgba(255, 255, 255, 0.25);
54
62
}
55
63
```
56
64
57
65
## Declaration Order
58
66
59
-
All properties should be consistently ordered according to the following standard.
67
+
All properties should be consistently ordered according to the following standard. Include a newline between these groups.
60
68
61
-
>Property specific mixins live where the expanded property would live. For example, if you're using a background–image mixin, that should live in the Visual Styles block instead of in the standard includes section.
62
-
63
-
1. Extends
64
-
1. Mixins/Includes (except for property specific mixins)
65
-
1. Position
66
-
1. Display & Box Model
67
-
1. Visual Styles
69
+
1. Extends (`@extend`)
70
+
1. Mixins (`@include`)
71
+
1. Generated content & CSS counters
72
+
1. Positioning
73
+
1. Display, layout modes & box model
74
+
1. Visual styles
68
75
1. Text Styles
69
-
1. Vendor Prefixed Styles
70
-
1. Animations & Transitions
71
-
1. Pseudo-classes
76
+
1. Transforms
77
+
1. Transitions & animations
78
+
1. Browser UI adjustments
79
+
1. Non-standard properties
80
+
1. Pseudo-classes & states
72
81
1. Pseudo-elements
73
-
1.Modifier elements
74
-
1.Child elements
82
+
1.BEM Modifiers
83
+
1.Descendents
75
84
76
85
```scss
77
86
.x-selector {
78
-
// Extends
79
-
@extend%x-extend;
87
+
// Extends
88
+
@extend%x-extend;
80
89
81
-
//Includes
82
-
@includemixin();
90
+
//Include mixins
91
+
@includemixin();
83
92
84
-
// Content
85
-
content: '\25B6';
93
+
// Content
94
+
content: '\25B6';
95
+
quotes: quotes: '“''”''‘''’';
96
+
counter-reset: my-counter
97
+
counter-increment: my-counter;
86
98
87
99
// Positioning
88
100
position: absolute;
89
-
left: 10px;
90
-
z-index: 10;
101
+
top: 10px;
102
+
right: 10px;
103
+
left: 10px;
104
+
z-index: 100;
91
105
92
106
// Display & Box Model
93
-
display: inline-block;
107
+
display: flex;
94
108
overflow: hidden;
109
+
float: left;
110
+
clear: both;
111
+
table-layout: fixed;
112
+
flex-flow: rowwrap;
113
+
align-items: center;
114
+
flex: 11auto;
115
+
order: 1;
95
116
box-sizing: border-box;
96
117
width: 100px;
118
+
min-width: 0;
97
119
height: 100px;
98
-
margin: 10px;
99
-
padding: 10px;
100
-
border: 1pxsolid#333;
120
+
max-height: none;
121
+
margin: 10px;
122
+
padding: 10px;
123
+
border: 1pxsolid#333;
101
124
102
125
// Visual styles
126
+
visibility: visible;
127
+
opacity: 1;
128
+
border-radius: 10px;
103
129
background: #000;
104
-
border-radius: 10px;
105
-
@includebox-shadow(5px5px0rgba(0, 0, 0, 0);
106
-
107
-
// Text styles
130
+
box-shadow: 5px5px0rgba(0, 0, 0, 0);
131
+
outline: 2pxsolid#039;
132
+
133
+
// Text styles
108
134
color: #fff;
109
135
font-family: sans-serif;
110
136
font-size: 16px;
137
+
line-height: 1.5;
111
138
text-align: right;
112
-
113
-
// Vendor prefixed styles
114
-
-webkit-user-select: none;
115
-
-webkit-tap-highlight: rgba(0, 0, 0, 0);
116
-
117
-
// Styles that don't fall under any of the above categories
118
-
pointer-events: none;
119
-
120
-
// Animations & Transitions
121
-
transition: all0.2s;
139
+
list-syle: none;
140
+
141
+
// Transforms
142
+
transform: translate3d(0, 0, 0);
143
+
perspective: 1000;
144
+
backface-visibility: hidden;
145
+
146
+
// Transitions & animations
147
+
transition: all0.2s;
148
+
animation-name: foo;
149
+
150
+
// Browser UI
151
+
user-select: none;
152
+
resize: vertical;
153
+
pointer-events: none;
154
+
155
+
// Non-standard properties
156
+
-webkit-appearance: none;
157
+
-webkit-overflow-scrolling: touch;
158
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
122
159
123
-
// Pseudo-classes
124
-
&:active{
125
-
background: blue;
126
-
}
127
-
&:last-child {
128
-
border-top: 1pxsolidblue;
129
-
}
160
+
// Pseudo-classes and states
161
+
&:active {
162
+
background: blue;
163
+
}
164
+
165
+
&:last-child {
166
+
border-top: 1pxsolidblue;
167
+
}
130
168
131
-
// Pseudo-elements
132
-
&::before{
133
-
content: 'CSS Rules!';
134
-
}
169
+
// Pseudo-elements
170
+
&::before {
171
+
content: 'CSS Rules!';
172
+
}
135
173
136
-
//Modifier Elements
137
-
&.x--light{
138
-
background: #999;
139
-
}
174
+
//BEM Modifiers
175
+
&.x--light {
176
+
background: #999;
177
+
}
140
178
141
-
// Child Elements
142
-
span{
143
-
font-weight: bold;
144
-
}
179
+
// Descendents (selecting client markup)
180
+
> .child,
181
+
.descendent {
182
+
font-weight: bold;
183
+
}
145
184
}
146
185
```
147
186
@@ -151,21 +190,21 @@ Sometimes we break out of this convention to add to the readability of our style
151
190
152
191
```scss
153
192
.x-selector {
154
-
@include icon(
155
-
home,
156
-
$color:blue,
157
-
$size:15px
158
-
);
193
+
@includeicon(
194
+
home,
195
+
$color: blue,
196
+
$size: 15px
197
+
);
159
198
160
-
transition:
161
-
opacity0.2sease-in-out,
162
-
width0.5slinear;
199
+
transition:
200
+
opacity0.2sease-in-out,
201
+
width0.5slinear;
163
202
}
164
203
```
165
204
166
205
## Preprocessor/SCSS Guidelines
167
206
168
-
As mentioned earlier, we use SASS and Compass to build our CSS. We have some guidelines when using these guys.
207
+
As mentioned earlier, we use Sass and Compass to build our CSS. We have some guidelines when using these guys.
0 commit comments