Skip to content

Commit 58d26d2

Browse files
author
Nick Hess
committed
update styling for rscss
1 parent f5850f0 commit 58d26d2

File tree

1 file changed

+110
-108
lines changed

1 file changed

+110
-108
lines changed

README.md

+110-108
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
# Big Spaceship CSS / Sass Styleguide
22

3-
*A mostly reasonable approach to CSS and Sass*
3+
_A mostly reasonable approach to CSS and Sass_
44

55
## Table of Contents
66

77
1. [Terminology](#terminology)
8-
- [Rule Declaration](#rule-declaration)
9-
- [Selectors](#selectors)
10-
- [Properties](#properties)
8+
- [Rule Declaration](#rule-declaration)
9+
- [Selectors](#selectors)
10+
- [Properties](#properties)
1111
1. [CSS](#css)
12-
- [Formatting](#formatting)
13-
- [Comments](#comments)
14-
- [OOCSS and BEM](#oocss-and-bem)
15-
- [ID Selectors](#id-selectors)
16-
- [JavaScript hooks](#javascript-hooks)
17-
- [Border](#border)
12+
- [Formatting](#formatting)
13+
- [Comments](#comments)
14+
- [OOCSS and RSCSS](#oocss-and-rscss)
15+
- [ID Selectors](#id-selectors)
16+
- [JavaScript hooks](#javascript-hooks)
17+
- [Border](#border)
1818
1. [Sass](#sass)
19-
- [Syntax](#syntax)
20-
- [Ordering](#ordering-of-property-declarations)
21-
- [Variables](#variables)
22-
- [Mixins](#mixins)
23-
- [Extend directive](#extend-directive)
24-
- [Nested selectors](#nested-selectors)
19+
- [Syntax](#syntax)
20+
- [Ordering](#ordering-of-property-declarations)
21+
- [Variables](#variables)
22+
- [Mixins](#mixins)
23+
- [Extend directive](#extend-directive)
24+
- [Nested selectors](#nested-selectors)
2525
1. [Translation](#translation)
2626
1. [License](#license)
2727

@@ -57,7 +57,8 @@ In a rule declaration, “selectors” are the bits that determine which element
5757
Finally, properties are what give the selected elements of a rule declaration their style. Properties are key-value pairs, and a rule declaration can contain one or more property declarations. Property declarations look like this:
5858

5959
```css
60-
/* some selector */ {
60+
/* some selector */
61+
{
6162
background: #f1f1f1;
6263
color: #333;
6364
}
@@ -69,24 +70,26 @@ Finally, properties are what give the selected elements of a rule declaration th
6970

7071
### Formatting
7172

72-
* Use soft tabs (2 spaces) for indentation
73-
* Prefer dashes over camelCasing in class names.
74-
- Underscores and PascalCasing are okay if you are using BEM (see [OOCSS and BEM](#oocss-and-bem) below).
75-
* Do not use ID selectors
76-
* When using multiple selectors in a rule declaration, give each selector its own line.
77-
* Put a space before the opening brace `{` in rule declarations
78-
* In properties, put a space after, but not before, the `:` character.
79-
* Put closing braces `}` of rule declarations on a new line
80-
* Put blank lines between rule declarations
73+
- Use soft tabs (2 spaces) for indentation
74+
- Prefer dashes over camelCasing in class names.
75+
- Do not use ID selectors
76+
- When using multiple selectors in a rule declaration, give each selector its own line.
77+
- Put a space before the opening brace `{` in rule declarations
78+
- In properties, put a space after, but not before, the `:` character.
79+
- Put closing braces `}` of rule declarations on a new line
80+
- Put blank lines between rule declarations
8181

8282
**Bad**
8383

8484
```css
85-
.avatar{
86-
border-radius:50%;
87-
border:2px solid white; }
88-
.no, .nope, .not_good {
89-
// ...
85+
.avatar {
86+
border-radius: 50%;
87+
border: 2px solid white;
88+
}
89+
.no,
90+
.nope,
91+
.not_good {
92+
// ...
9093
}
9194
#lol-no {
9295
// ...
@@ -110,63 +113,62 @@ Finally, properties are what give the selected elements of a rule declaration th
110113

111114
### Comments
112115

113-
* Prefer line comments (`//` in Sass-land) to block comments.
114-
* Prefer comments on their own line. Avoid end-of-line comments.
115-
* Write detailed comments for code that isn't self-documenting:
116+
- Prefer line comments (`//` in Sass-land) to block comments.
117+
- Prefer comments on their own line. Avoid end-of-line comments.
118+
- Write detailed comments for code that isn't self-documenting:
116119
- Uses of z-index
117120
- Compatibility or browser-specific hacks
118121

119-
### OOCSS and BEM
122+
### OOCSS and RSCSS
120123

121-
We encourage some combination of OOCSS and BEM for these reasons:
124+
We encourage some combination of OOCSS and RSCSS for these reasons:
122125

123-
* It helps create clear, strict relationships between CSS and HTML
124-
* It helps us create reusable, composable components
125-
* It allows for less nesting and lower specificity
126-
* It helps in building scalable stylesheets
126+
- It helps create clear, strict relationships between CSS and HTML
127+
- It helps us create reusable, composable components
128+
- It allows for less nesting and lower specificity
129+
- It helps in building scalable stylesheets
127130

128131
**OOCSS**, or “Object Oriented CSS”, is an approach for writing CSS that encourages you to think about your stylesheets as a collection of “objects”: reusable, repeatable snippets that can be used independently throughout a website.
129132

130-
* Nicole Sullivan's [OOCSS wiki](https://github.com/stubbornella/oocss/wiki)
131-
* Smashing Magazine's [Introduction to OOCSS](http://www.smashingmagazine.com/2011/12/12/an-introduction-to-object-oriented-css-oocss/)
133+
- Nicole Sullivan's [OOCSS wiki](https://github.com/stubbornella/oocss/wiki)
134+
- Smashing Magazine's [Introduction to OOCSS](http://www.smashingmagazine.com/2011/12/12/an-introduction-to-object-oriented-css-oocss/)
132135

133-
**BEM**, or “Block-Element-Modifier”, is a _naming convention_ for classes in HTML and CSS. It was originally developed by Yandex with large codebases and scalability in mind, and can serve as a solid set of guidelines for implementing OOCSS.
136+
**RSCSS**, or “Reasonable-SCSS”, is a _naming convention_ for classes in HTML and CSS. It is a set of ideas to guide your process of building maintainable CSS, and can serve as a solid set of guidelines for implementing OOCSS.
134137

135-
* CSS Trick's [BEM 101](https://css-tricks.com/bem-101/)
136-
* Harry Roberts' [introduction to BEM](http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/)
137-
138-
We recommend a variant of BEM with PascalCased “blocks”, which works particularly well when combined with components (e.g. React). Underscores and dashes are still used for modifiers and children.
138+
- RSCSS [RSCSS](http://rscss.io/index.html)
139139

140140
**Example**
141141

142142
```jsx
143143
// ListingCard.jsx
144144
function ListingCard() {
145145
return (
146-
<article class="ListingCard ListingCard--featured">
147-
148-
<h1 class="ListingCard__title">Adorable 2BR in the sunny Mission</h1>
146+
<article class="listing-card -featured">
147+
<h1 class="title">Adorable 2BR in the sunny Mission</h1>
149148

150-
<div class="ListingCard__content">
149+
<div class="content">
151150
<p>Vestibulum id ligula porta felis euismod semper.</p>
152151
</div>
153-
154152
</article>
155153
);
156154
}
157155
```
158156

159157
```css
160158
/* ListingCard.css */
161-
.ListingCard { }
162-
.ListingCard--featured { }
163-
.ListingCard__title { }
164-
.ListingCard__content { }
159+
.listing-card {
160+
}
161+
.Listing-card.-featured {
162+
}
163+
.listing-card .title {
164+
}
165+
.listing-card .content {
166+
}
165167
```
166168

167-
* `.ListingCard` is the “block” and represents the higher-level component
168-
* `.ListingCard__title` is an “element” and represents a descendant of `.ListingCard` that helps compose the block as a whole.
169-
* `.ListingCard--featured` is a “modifier” and represents a different state or variation on the `.ListingCard` block.
169+
- `.listing-card` is the “block” and represents the higher-level component
170+
- `.listing-card .title` is an “element” and represents a descendant of `.listing-card` that helps compose the block as a whole.
171+
- `.-featured` is a “modifier” and represents a different state or variation on the `.listing-card` block.
170172

171173
### ID selectors
172174

@@ -203,57 +205,58 @@ Use `0` instead of `none` to specify that a style has no border.
203205
border: 0;
204206
}
205207
```
208+
206209
**[⬆ back to top](#table-of-contents)**
207210

208211
## Sass
209212

210213
### Syntax
211214

212-
* Use the `.scss` syntax, never the original `.sass` syntax
213-
* Order your regular CSS and `@include` declarations logically (see below)
215+
- Use the `.scss` syntax, never the original `.sass` syntax
216+
- Order your regular CSS and `@include` declarations logically (see below)
214217

215218
### Ordering of property declarations
216219

217220
1. Property declarations
218221

219-
List all standard property declarations, anything that isn't an `@include` or a nested selector.
222+
List all standard property declarations, anything that isn't an `@include` or a nested selector.
220223

221-
```scss
222-
.btn-green {
223-
background: green;
224-
font-weight: bold;
225-
// ...
226-
}
227-
```
224+
```scss
225+
.btn-green {
226+
background: green;
227+
font-weight: bold;
228+
// ...
229+
}
230+
```
228231

229232
2. `@include` declarations
230233

231-
Grouping `@include`s at the end makes it easier to read the entire selector.
234+
Grouping `@include`s at the end makes it easier to read the entire selector.
232235

233-
```scss
234-
.btn-green {
235-
background: green;
236-
font-weight: bold;
237-
@include transition(background 0.5s ease);
238-
// ...
239-
}
240-
```
236+
```scss
237+
.btn-green {
238+
background: green;
239+
font-weight: bold;
240+
@include transition(background 0.5s ease);
241+
// ...
242+
}
243+
```
241244

242245
3. Nested selectors
243246

244-
Nested selectors, _if necessary_, go last, and nothing goes after them. Add whitespace between your rule declarations and nested selectors, as well as between adjacent nested selectors. Apply the same guidelines as above to your nested selectors.
247+
Nested selectors, _if necessary_, go last, and nothing goes after them. Add whitespace between your rule declarations and nested selectors, as well as between adjacent nested selectors. Apply the same guidelines as above to your nested selectors.
245248

246-
```scss
247-
.btn {
248-
background: green;
249-
font-weight: bold;
250-
@include transition(background 0.5s ease);
249+
```scss
250+
.btn {
251+
background: green;
252+
font-weight: bold;
253+
@include transition(background 0.5s ease);
251254

252-
.icon {
253-
margin-right: 10px;
254-
}
255-
}
256-
```
255+
.icon {
256+
margin-right: 10px;
257+
}
258+
}
259+
```
257260

258261
### Variables
259262

@@ -283,10 +286,9 @@ Mixins should be used to DRY up your code, add clarity, or abstract complexity--
283286

284287
When selectors become this long, you're likely writing CSS that is:
285288

286-
* Strongly coupled to the HTML (fragile) *—OR—*
287-
* Overly specific (powerful) *—OR—*
288-
* Not reusable
289-
289+
- Strongly coupled to the HTML (fragile) _—OR—_
290+
- Overly specific (powerful) _—OR—_
291+
- Not reusable
290292

291293
Again: **never nest ID selectors!**
292294

@@ -296,21 +298,21 @@ If you must use an ID selector in the first place (and you should really try not
296298

297299
## Translation
298300

299-
This style guide is also available in other languages:
300-
301-
- ![id](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Indonesia.png) **Bahasa Indonesia**: [mazipan/css-style-guide](https://github.com/mazipan/css-style-guide)
302-
- ![tw](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Taiwan.png) **Chinese (Traditional)**: [ArvinH/css-style-guide](https://github.com/ArvinH/css-style-guide)
303-
- ![cn](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/China.png) **Chinese (Simplified)**: [Zhangjd/css-style-guide](https://github.com/Zhangjd/css-style-guide)
304-
- ![fr](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/France.png) **French**: [mat-u/css-style-guide](https://github.com/mat-u/css-style-guide)
305-
- ![ja](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Japan.png) **Japanese**: [nao215/css-style-guide](https://github.com/nao215/css-style-guide)
306-
- ![ko](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/South-Korea.png) **Korean**: [CodeMakeBros/css-style-guide](https://github.com/CodeMakeBros/css-style-guide)
307-
- ![PT-BR](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Brazil.png) **Portuguese (Brazil)**: [felipevolpatto/css-style-guide](https://github.com/felipevolpatto/css-style-guide)
308-
- ![pt-PT](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Portugal.png) **Portuguese (Portugal)**: [SandroMiguel/airbnb-css-style-guide](https://github.com/SandroMiguel/airbnb-css-style-guide)
309-
- ![ru](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Russia.png) **Russian**: [rtplv/airbnb-css-ru](https://github.com/rtplv/airbnb-css-ru)
310-
- ![es](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Spain.png) **Spanish**: [ismamz/guia-de-estilo-css](https://github.com/ismamz/guia-de-estilo-css)
311-
- ![vn](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Vietnam.png) **Vietnamese**: [trungk18/css-style-guide](https://github.com/trungk18/css-style-guide)
312-
- ![vn](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Italy.png) **Italian**: [antoniofull/linee-guida-css](https://github.com/antoniofull/linee-guida-css)
313-
- ![de](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Germany.png) **German**: [tderflinger/css-styleguide](https://github.com/tderflinger/css-styleguide)
301+
This style guide is also available in other languages:
302+
303+
- ![id](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Indonesia.png) **Bahasa Indonesia**: [mazipan/css-style-guide](https://github.com/mazipan/css-style-guide)
304+
- ![tw](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Taiwan.png) **Chinese (Traditional)**: [ArvinH/css-style-guide](https://github.com/ArvinH/css-style-guide)
305+
- ![cn](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/China.png) **Chinese (Simplified)**: [Zhangjd/css-style-guide](https://github.com/Zhangjd/css-style-guide)
306+
- ![fr](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/France.png) **French**: [mat-u/css-style-guide](https://github.com/mat-u/css-style-guide)
307+
- ![ja](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Japan.png) **Japanese**: [nao215/css-style-guide](https://github.com/nao215/css-style-guide)
308+
- ![ko](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/South-Korea.png) **Korean**: [CodeMakeBros/css-style-guide](https://github.com/CodeMakeBros/css-style-guide)
309+
- ![PT-BR](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Brazil.png) **Portuguese (Brazil)**: [felipevolpatto/css-style-guide](https://github.com/felipevolpatto/css-style-guide)
310+
- ![pt-PT](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Portugal.png) **Portuguese (Portugal)**: [SandroMiguel/airbnb-css-style-guide](https://github.com/SandroMiguel/airbnb-css-style-guide)
311+
- ![ru](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Russia.png) **Russian**: [rtplv/airbnb-css-ru](https://github.com/rtplv/airbnb-css-ru)
312+
- ![es](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Spain.png) **Spanish**: [ismamz/guia-de-estilo-css](https://github.com/ismamz/guia-de-estilo-css)
313+
- ![vn](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Vietnam.png) **Vietnamese**: [trungk18/css-style-guide](https://github.com/trungk18/css-style-guide)
314+
- ![vn](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Italy.png) **Italian**: [antoniofull/linee-guida-css](https://github.com/antoniofull/linee-guida-css)
315+
- ![de](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Germany.png) **German**: [tderflinger/css-styleguide](https://github.com/tderflinger/css-styleguide)
314316

315317
**[⬆ back to top](#table-of-contents)**
316318

0 commit comments

Comments
 (0)