Skip to content

Commit f53d062

Browse files
committed
Merge pull request #125 from HugoGiraudel/develop
[RFR] 1.1.0
2 parents de95a21 + 3e303c2 commit f53d062

File tree

10 files changed

+175
-50
lines changed

10 files changed

+175
-50
lines changed

_data/languages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ nl:
2828
link: https://github.com/ttomdewit
2929

3030
en:
31-
version: 1.0.0
31+
version: 1.1.0
3232
label: English
3333
prefix: /
3434
available: true

en/_author.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# About the author
33

4-
My name is [Hugo Giraudel](http://hugogiraudel.com), I am a front-end developer from France about to move to Berlin, Germany. I have been writing Sass for over two years now and am the author of Sass-related projects such as [SassDoc](http://sassdoc.com) and [Sass-Compatibility](http://sass-compatibility.github.io).
4+
My name is [Hugo Giraudel](http://hugogiraudel.com), I am a French front-end developer based in Berlin, Germany. I have been writing Sass for over two years now and am the author of Sass-related projects such as [SassDoc](http://sassdoc.com) and [Sass-Compatibility](http://sass-compatibility.github.io). I also wrote a book about CSS (in French) entitled [CSS3 Pratique du Design Web](http://www.amazon.fr/dp/2212140231).
55

66
I have also written a couple of Sass libraries, mostly for the heck of it: [SassyJSON](https://github.com/HugoGiraudel/SassyJSON), [SassyLists](http://sassylists.com), [SassySort](https://github.com/HugoGiraudel/SassySort), [SassyCast](https://github.com/HugoGiraudel/SassyCast), [SassyMatrix](https://github.com/HugoGiraudel/SassyMatrix), [SassyBitwise](https://github.com/HugoGiraudel/SassyBitwise), [SassyIteratorsGenerators](https://github.com/HugoGiraudel/SassyIteratorsGenerators), [SassyLogger](https://github.com/HugoGiraudel/SassyLogger), [SassyStrings](https://github.com/HugoGiraudel/SassyStrings) and [SassyGradients](https://github.com/HugoGiraudel/SassyGradients).
77

en/_conditions.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,35 @@ When testing for a falsy value, always use the `not` keyword rather than testing
7676
</div>
7777
</div>
7878

79+
Always put the variable part on the left side of the statement, and the (un)expected result on the right. Reversed conditional statements often are more difficult to read, especially to unexperienced developers.
80+
81+
<div class="code-block">
82+
<div class="code-block__wrapper" data-syntax="scss">
83+
{% highlight scss %}
84+
// Yep
85+
@if $value == 42 {
86+
// ...
87+
}
88+
89+
// Nope
90+
@if 42 == $value {
91+
// ...
92+
}
93+
{% endhighlight %}
94+
</div>
95+
<div class="code-block__wrapper" data-syntax="sass">
96+
{% highlight sass %}
97+
// Yep
98+
@if $value == 42
99+
// ...
100+
101+
// Nope
102+
@if 42 == $value
103+
// ...
104+
{% endhighlight %}
105+
</div>
106+
</div>
107+
79108
When using conditional statements within a function to return a different result based on some condition, always make sure the function still has a `@return` statement outside of any conditional block.
80109

81110
<div class="code-block">

en/_mixins.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,18 @@ Sass is actually pretty clever with mixins and function declarations, so much so
123123
@include dummy(true, 42, 'kittens');
124124

125125
// Yep but nope
126-
$params: true, 42, 'kittens';
126+
$params: (true, 42, 'kittens');
127127
$value: dummy(nth($params, 1), nth($params, 2), nth($params, 3));
128128

129129
// Yep
130-
$params: true, 42, 'kittens';
130+
$params: (true, 42, 'kittens');
131131
@include dummy($params...);
132132

133133
// Yep
134134
$params: (
135135
'c': 'kittens',
136136
'a': true,
137-
'b': 42
137+
'b': 42,
138138
);
139139
@include dummy($params...);
140140
{% endhighlight %}
@@ -148,15 +148,15 @@ $params: (
148148
+dummy(true, 42, 'kittens')
149149

150150
// Yep but nope
151-
$params: true, 42, 'kittens'
151+
$params: (true, 42, 'kittens')
152152
$value: dummy(nth($params, 1), nth($params, 2), nth($params, 3))
153153

154154
// Yep
155-
$params: true, 42, 'kittens'
155+
$params: (true, 42, 'kittens')
156156
+dummy($params...)
157157

158158
// Yep
159-
$params: ( 'c': 'kittens', 'a': true, 'b': 42, )
159+
$params: ('c': 'kittens', 'a': true, 'b': 42,)
160160
+dummy($params...)
161161
{% endhighlight %}
162162
</div>
@@ -246,14 +246,14 @@ Then using this mixin should be very straightforward:
246246
<div class="code-block__wrapper" data-syntax="scss">
247247
{% highlight scss %}
248248
.foo {
249-
@include prefix(transform, rotate(90deg), webkit ms);
249+
@include prefix(transform, rotate(90deg), ('webkit', 'ms'));
250250
}
251251
{% endhighlight %}
252252
</div>
253253
<div class="code-block__wrapper" data-syntax="sass">
254254
{% highlight sass %}
255255
.foo
256-
+prefix(transform, rotate(90deg), webkit ms)
256+
+prefix(transform, rotate(90deg), ('webkit', 'ms'))
257257
{% endhighlight %}
258258
</div>
259259
</div>

en/_naming.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,19 @@ As for many languages, I suggest all-caps snakerized variables when they are con
6161
<div class="code-block__wrapper" data-syntax="scss">
6262
{% highlight scss %}
6363
// Yep
64-
$CSS_POSITIONS: top, right, bottom, left, center;
64+
$CSS_POSITIONS: (top, right, bottom, left, center);
6565

6666
// Nope
67-
$css-positions: top, right, bottom, left, center;
67+
$css-positions: (top, right, bottom, left, center);
6868
{% endhighlight %}
6969
</div>
7070
<div class="code-block__wrapper" data-syntax="sass">
7171
{% highlight sass %}
7272
// Yep
73-
$CSS_POSITIONS: top, right, bottom, left, center
73+
$CSS_POSITIONS: (top, right, bottom, left, center)
7474

7575
// Nope
76-
$css-positions: top, right, bottom, left, center
76+
$css-positions: (top, right, bottom, left, center)
7777
{% endhighlight %}
7878
</div>
7979
</div>

en/_rwd.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ $breakpoints: ('seed': (min-width: 800px), 'sprout': (min-width: 1000px), 'plant
6262
</div>
6363
</div>
6464

65+
<div class="note">
66+
<p>The previous examples uses nested maps to define breakpoints, however this really depends on what kind of breakpoint manager you use. You could opt for strings rather than inner maps for more flexibility (e.g. <code>'(min-width: 800px)'</code>).</p>
67+
</div>
68+
6569

6670

6771

@@ -86,8 +90,12 @@ Once you have named your breakpoints the way you want, you need a way to use the
8690
/// @param {String} $breakpoint - Breakpoint
8791
/// @requires $breakpoints
8892
@mixin respond-to($breakpoint) {
89-
@if map-has-key($breakpoints, $breakpoint) {
90-
@media #{inspect(map-get($breakpoints, $breakpoint))} {
93+
$raw-query: map-get($breakpoints, $breakpoint);
94+
95+
@if $raw-query {
96+
$query: if(type-of($raw-query) == 'string', unquote($raw-query), inspect($raw-query));
97+
98+
@media #{$query} {
9199
@content;
92100
}
93101
} @else {
@@ -104,8 +112,12 @@ Once you have named your breakpoints the way you want, you need a way to use the
104112
/// @param {String} $breakpoint - Breakpoint
105113
/// @requires $breakpoints
106114
=respond-to($breakpoint)
107-
@if map-has-key($breakpoints, $breakpoint)
108-
@media #{inspect(map-get($breakpoints, $breakpoint))}
115+
$raw-query: map-get($breakpoints, $breakpoint)
116+
117+
@if $raw-query
118+
$query: if(type-of($raw-query) == 'string', unquote($raw-query), inspect($raw-query))
119+
120+
@media #{$query}
109121
@content
110122

111123
@else
@@ -116,8 +128,7 @@ Once you have named your breakpoints the way you want, you need a way to use the
116128
</div>
117129

118130
<div class="note">
119-
<p>Obviously, this is a fairly simplistic breakpoint manager that will not do the trick when dealing with custom and/or multiple-checks breakpoints.</p>
120-
<p>If you need a slightly more permissive breakpoint manager, may I recommend you do not reinvent the wheel and use something that has been proven effective such as <a href="https://github.com/sass-mq/sass-mq">Sass-MQ</a>, <a href="http://breakpoint-sass.com/">Breakpoint</a> or <a href="https://github.com/eduardoboucas/include-media">include-media</a>.</p>
131+
<p>Obviously, this is a fairly simplistic breakpoint manager. If you need a slightly more permissive one, may I recommend you do not reinvent the wheel and use something that has been proven effective such as <a href="https://github.com/sass-mq/sass-mq">Sass-MQ</a>, <a href="http://breakpoint-sass.com/">Breakpoint</a> or <a href="https://github.com/eduardoboucas/include-media">include-media</a>.</p>
121132
</div>
122133

123134

en/_sass.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ On non-Ruby projects that need a workflow integration, LibSass is probably a bet
3838
### Further reading
3939

4040
* [LibSass](https://github.com/sass/libsass)
41+
* [Getting to know LibSass](http://webdesign.tutsplus.com/articles/getting-to-know-libsass--cms-23114)
4142
* [Sass-Compatibility](http://sass-compatibility.github.io)
4243
* [Switching from Ruby Sass to LibSass](http://www.sitepoint.com/switching-ruby-sass-libsass/)
4344

@@ -56,7 +57,7 @@ Since then, Sass (the preprocessor) has been providing two different syntaxes: S
5657

5758
Sass’s whitespace-sensitive syntax relies on indentation to get rid of braces, semi-colons and other punctuation symbols, leading to a leaner and shorter syntax. Meanwhile, SCSS is easier to learn since it’s mostly some tiny extra bits on top of CSS.
5859

59-
I, myself, prefer SCSS over Sass because it is closer to CSS and friendlier to most developers. Because of that, I will use SCSS rather than Sass throughout these guidelines.
60+
I, myself, prefer SCSS over Sass because it is closer to CSS and friendlier to most developers. Because of that, SCSS is the default syntax throughout these guidelines. You can switch to Sass indented syntax in the <span data-toggle="aside" class="link-like" role="button" aria-expanded>options panel</span>.
6061

6162

6263

0 commit comments

Comments
 (0)