Skip to content

Commit 7348677

Browse files
committed
Adds SCSS example
1 parent d9370c7 commit 7348677

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

_includes/scss/nesting.scss

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Bad example
2+
.component {
3+
color: #333;
4+
5+
.component-piece {
6+
background: #fff;
7+
8+
.component-subpiece {
9+
border: 5px solid #555;
10+
}
11+
}
12+
}
13+
14+
15+
// Good example
16+
.component {
17+
color: #333;
18+
19+
.component-piece {
20+
background: #fff;
21+
}
22+
23+
.component-subpiece {
24+
border: 5px solid #555;
25+
}
26+
}

index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,24 @@ <h3>Organization</h3>
415415
<h2>SCSS</h2>
416416
</div>
417417

418+
<div class="section" id="scss-nesting">
419+
<div class="col">
420+
<h3>Nesting</h3>
421+
<ul>
422+
<li>Avoid nesting selectors greater than 3 levels deep</li>
423+
</ul>
424+
<p>Additional reading:</p>
425+
<ul>
426+
<li><a href="http://markdotto.com/2012/02/16/scope-css-classes-with-prefixes/">Scope CSS classes with prefixes</a></li>
427+
<li><a href="http://markdotto.com/2012/03/02/stop-the-cascade/">Stop the cascade</a></li>
428+
</ul>
429+
</div>
430+
<div class="col">
431+
{% highlight scss %}{% include scss/nesting.scss %}{% endhighlight %}
432+
</div>
433+
</div>
434+
435+
418436
<div class="section" id="css-editor-prefs">
419437
<div class="col">
420438
<h3>Editor preferences</h3>

0 commit comments

Comments
 (0)