Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 35af6e1

Browse files
committed
Add scss syntax highlights to code examples
1 parent 9778e89 commit 35af6e1

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

css/sass-best-practices/readme.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ As a rule of thumb, try to avoid `@extend`.
6161

6262
The main problem with `@extend` is that it is easy to bloat your code by using it. When first starting to use it, the code can be very innocent in appearance, such as:
6363

64-
```
64+
```scss
6565
// SCSS code
6666
.c-button {}
6767

@@ -76,7 +76,7 @@ The main problem with `@extend` is that it is easy to bloat your code by using i
7676

7777
That does appear pretty innocent. However, what happens if we do this:
7878

79-
```
79+
```scss
8080
// SCSS code
8181
.c-button {}
8282

@@ -101,7 +101,7 @@ Whoa! See what happened? Notice the extra selector that got compiled that we pro
101101

102102
So there is a workaround for the problem we described above: __never directly extend a standard class__. Instead, __only extend placeholder classes__. Let's see what that looks like using the same example from above:
103103

104-
```
104+
```scss
105105
// SCSS code
106106
.c-button, %c-button {} // Notice that this is a placeholder class
107107

@@ -130,7 +130,7 @@ __Scenario 1__: There are situations where you want to have default styles on el
130130

131131
This is how we deal with this scenario using `@extend`:
132132

133-
```
133+
```scss
134134
// In `/vellum`
135135
// ---
136136

@@ -167,7 +167,7 @@ __Scenario 2__: This scenario is very specific to Mobify and here is why... as y
167167

168168
What are the consequences of not being able to control parts of the DOM? It means we might not be able to add classes to the DOM reliably, which means that we can't apply our styles as easily as we would like. Instead, we are forced to write some gnarly selectors to ensure these situations can work. Let's use BazaarVoice again as our example:
169169

170-
```
170+
```scss
171171
[id="BVRRContainer"] {
172172

173173
.BVRRSortSelectWidget {
@@ -238,7 +238,7 @@ The second aspect of comments are the comments themselves! There are three types
238238

239239
1. General Comments
240240

241-
```
241+
```scss
242242
// My Component
243243
// ============
244244
//
@@ -255,7 +255,7 @@ Direct comments are those that apply to a single line of code as denoted by the
255255

256256
Be aware that these notes typically only refer to the code directly beneath it, as far as just before the next section (i.e. the next sub-component). That next section could have it's own Direct Notes, but they will only apply to that section despite using the same numbers.
257257

258-
```
258+
```scss
259259
// My Component
260260
// ============
261261
//
@@ -295,7 +295,7 @@ So Note A will always refer to the same note.
295295

296296
This is a rare use case, but can be useful sometimes when you have the same set of changes that need to be applied across more than one section of code.
297297

298-
```
298+
```scss
299299
// My Component
300300
// ============
301301
//
@@ -337,7 +337,7 @@ Do note that variables without modifiers are implicitly the base version of that
337337

338338
For color gradients, we follow a convention that looks like `{modifier}-{name}-{number}` where the number _roughly_ corresponds to some property level of that color, such as the greyscale level.
339339

340-
```
340+
```scss
341341
$grey-10 // 10% greyscale
342342
$grey-20 // 20% greyscale
343343
$grey-30 // 30% greyscale

0 commit comments

Comments
 (0)