Skip to content

Commit 9cc13c5

Browse files
Merge pull request #9 from zweitag/resolve-external-links
Resolve external links
2 parents 54bfa71 + fb4723d commit 9cc13c5

File tree

5 files changed

+56
-33
lines changed

5 files changed

+56
-33
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Zweitag Approach to Scalable and Adaptable Frontends (ZASAF)
22

3-
[Einleitung zur Wichtigkeit von CSS Guidelines](http://cssguidelin.es/#introduction)
3+
Bei der Arbeit an großen, langlebigen Projekten mit vielen Entwicklern unterschiedlicher Spezialisierungen und Fähigkeiten ist es wichtig, dass alle einheitlich arbeiten, um Stylesheets sowohl pflegbar als auch skalierbar zu halten und um zu gewährleisten, dass der Code transparent und lesbar bleibt.
4+
5+
Aus diesem Antrieb heraus entstand dieser Styleguide, der es Entwicklern ermöglichen soll, die Code-Qualität hochzuhalten, die Code-Konsistenz zu wahren und produktiver zu arbeiten.
46

57
ZASAF folgt dem Grundgedanken von [BEM](http://getbem.com/) und [SMACSS](http://smacss.com), dass Frontends modular aufgebaut werden sollten.
68
Dabei unterscheiden wir jedoch noch einmal zwischen generischen und spezifischen Komponenten.
@@ -140,7 +142,7 @@ Die Syntax von BEM finden wir jedoch etwas sperrig und haben uns für ein andere
140142
.fact-list__entry
141143
list-style-type: discline-height: 1.2
142144
.fact-list__entry--highlighted
143-
font-weight: bold
145+
font-weight: 700
144146
</pre>
145147
</td>
146148
<td>
@@ -150,14 +152,14 @@ Die Syntax von BEM finden wir jedoch etwas sperrig und haben uns für ein andere
150152
.fact-list--entry
151153
line-height: 1.2
152154
&.highlighted
153-
font-weight: bold
155+
font-weight: 700
154156
</pre>
155157
</td>
156158
</tr>
157159
</table>
158160

159161
* Der Komponenten-Namensraum wird also mit `--` vom Elementnamen abgegrenzt.
160-
* Modifier kommen ohne Namensraum aus, da sie ausschließlich in Kombination mit einer Komponente bzw. einem Element eingesetzt werden
162+
* Modifier kommen ohne Namensraum aus, da sie ausschließlich in Kombination mit einer Komponente bzw. einem Element eingesetzt werden.
161163

162164
### Beispiel
163165

@@ -211,11 +213,15 @@ Die Syntax von BEM finden wir jedoch etwas sperrig und haben uns für ein andere
211213
+column(8)
212214
```
213215

216+
### Anpassung von Komponenten
217+
218+
Um ein und dieselbe Komponente auf unterschiedliche Art und Weise zu stylen, [gibt es folgende Optionen.](customizing-components.md)
219+
214220
## Globales und Hilfsmittel
215221

216222
### Globales
217223

218-
Im Order `globals` finden sich globale Basisstile und Konfigurationen:
224+
Im Order `globals` befinden sich globale Basisstile und Konfigurationen:
219225

220226
* _base.css.sass: Styling der HTML-Elemente (z.B. `strong {font-weight: 700}`)
221227
* _colors.css.sass: Farbdeklarationen (z.B. `$color-accent: $curious-blue`)
@@ -225,22 +231,16 @@ Im Order `globals` finden sich globale Basisstile und Konfigurationen:
225231

226232
### Hilfsmittel
227233

228-
Im Ordner `utilitis` finden sich Mixins, die in Komponenten eingesetzt werden können:
234+
Im Ordner `utilities` befinden sich Mixins, die in Komponenten eingesetzt werden können:
229235

230236
* _clearfix.css.sass
231237
* _font-smoothing.css.sass
232238
* _grid.css.sass
233239
* _responsify.css.sass
234240
*
235241

236-
## Best Practices
237-
238-
* [Customizing Components](customizing-components.md)
239-
* [CSS Best Practices](css-best-practices.md)
240-
* [Portability](http://cssguidelin.es/#portability)
241-
* [Specificity](http://cssguidelin.es/#specificity)
242-
243-
## Style Guides
242+
## Style Guides & Best Practices
244243

245244
* [Haml Style Guide](haml-style-guide.md)
246245
* [Sass Style Guide](sass-style-guide.md)
246+
* [CSS Best Practices](css-best-practices.md)

css-best-practices.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# CSS Best Practices
22

3+
Die Grundvoraussetzung für wartbares, leicht zu lesendes CSS ist eine niedrige Spezifität. Das CSS sollte so geschrieben werden, dass der Selektor spezifisch für das zu stylende Element ist. Dadurch wird ein Selektorstreit aus dem Weg gegangen und ein unnötiges Überschreiben von Selektoren vermieden (Ausnahmen bilden Modifier).
4+
35
## Selektorregeln
46

57
### Vermeide zu generische Selektoren
@@ -74,20 +76,42 @@ a.back
7476

7577
### Vermeide Nachfahrenselektoren
7678

77-
Der Nachfahrenselektor ist der teuerste Selektor in CSS. Gib dem entsprechenden Element besser eine Klasse und style es direkt.
79+
Der Nachfahrenselektor ist der teuerste Selektor in CSS. Die Verschachtelung von Selektoren muss auf ein Minimum reduziert werden. Gib dem entsprechenden Element besser eine Klasse und style es direkt.
7880

7981
**schlecht**
8082

8183
``` sass
8284
.link-list li a
8385
```
8486

87+
**genauso schlecht**
88+
89+
``` sass
90+
.link-list .link-list--link
91+
```
92+
8593
**gut**
8694

8795
``` sass
8896
.link-list--link
8997
```
9098

99+
### Vermeide ID-Selektoren
100+
101+
Es gibt zwei Gründe, warum man ID-Selektoren nicht fürs Styling verwenden sollte. Zum einen schraubt eine ID die Spezifität hoch, die im Grunde nur mit Nutzung einer weiteren ID wieder überschrieben werden kann. Das spricht gegen unser Mantra, die Spezifitäät niedrig zu halten (s.o.). Zum anderen müssen IDs im Markup einzigartig sein, woraus folgt, dass man Komponenten mit IDs nicht wiederverwenden kann.
102+
103+
**schlecht**
104+
105+
``` sass
106+
#navigation
107+
```
108+
109+
**gut**
110+
111+
``` sass
112+
.navigation
113+
```
114+
91115
### Vermeide den selben Selektor fürs Styling (CSS) und fürs Verhalten (JS) zu verwenden
92116

93117
Separation of concerns. Möchte man Javascript auf ein Element anwenden, hat es sich etabliert, hierfür ein `data-*`Attribut zu nutzen. Der Vorteil: Ändert man später nochmal das Klassenattribut, bleibt das Javascript weiterhin in Takt.

customizing-components.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## How do I customize components?
1+
# How do I customize components?
22

33
The ZASAF follows the Convention over Configuration principle: You should write components that come with good defaults.
44
If you want to deviate from the default there are two options:
@@ -9,7 +9,7 @@ If you want to deviate from the default there are two options:
99
Each of those options come with its own pros and cons, so choose carefully.
1010
Translate your rule into a human-understandable sentence – is this what you want to declare?
1111

12-
### Example
12+
## Example
1313

1414
``` haml
1515
.product-page
@@ -27,7 +27,7 @@ Translate your rule into a human-understandable sentence – is this what you wa
2727
So we start with a basic `.teaser` component in the sidebar of the `.product-page`.
2828
Now we look at the PSD or HTML or whatever the designer gave us and observe that this teaser should be more grayish than normal.
2929

30-
#### Option 1: Add a modifier
30+
### Option 1: Add a modifier
3131

3232
``` sass
3333
.teaser
@@ -65,7 +65,7 @@ Examples:
6565
6666
```
6767

68-
#### Option 2: Location-based customization
68+
### Option 2: Location-based customization
6969

7070
Now you are saying: "This particular teaser should be unobtrusive."
7171

haml-style-guide.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
## HAML best practices
1+
# HAML Styleguide
22

33
Because of the importance indentation has on how your code is rendered, the indents should be consistent throughout the document. Any differences in indentation will throw an error. It's common-practice to use two spaces.
44

5-
### How to use HTML elements
5+
## How to use HTML elements
66

77
To write your tags, use the percent sign followed by the name of the tag
88

@@ -30,7 +30,7 @@ If you want to add multiple classes, simply chain them:
3030
.container.large.unobtrusive
3131
```
3232

33-
### How to use comments
33+
## How to use comments
3434

3535
There’re three different styles to write comments in Haml.
3636

@@ -56,11 +56,11 @@ There’re three different styles to write comments in Haml.
5656

5757
**Note:** Single and multiline comments will be redenred into the document. Therefore we commonly choose the third option because usually comments are meant for developers only.
5858

59-
### Use blocks
59+
## Use blocks
6060

6161
HAML isn’t Ruby, but it still incorporates some convenient elements of it, and there’s no better example of that than the block syntax.
6262

63-
#### Morph code into block format with `precede`, `succeed` and `surround`
63+
### Morph code into block format with `precede`, `succeed` and `surround`
6464

6565
**Example:**
6666

@@ -93,7 +93,7 @@ Using inline HTML and `content_tag`
9393

9494
This isn’t terrible, but the above blocks are much more readable!
9595

96-
#### Use `link_to` as a block
96+
### Use `link_to` as a block
9797

9898
When wrapping long or multiple elements in a link tag, It’s wise to use `link_to` in block format.
9999

@@ -125,7 +125,7 @@ Rails routing is best used with its built-in helper methods, where objects can b
125125
%a{href: users_path(@user)} View User Profile
126126
```
127127

128-
#### Use `list_of`
128+
### Use `list_of`
129129

130130
A lesser known – and thus, lesser used – feature of HAML is `list_of`.
131131
This method generates * elements for you as you iterate over a list of items.
@@ -158,7 +158,7 @@ Whitespace abuse. Every time you use `list_of`, you’ve saved one indentation.
158158
= link_to student.name, [course, student]
159159
```
160160

161-
### Use filters
161+
## Use filters
162162

163163
Use the colon to define [Haml filters](http://haml.info/docs/yardoc/file.REFERENCE.html#filters). This allows you to pass an indented block of text as input to another filtering program and add the result to the output of Haml.
164164

@@ -176,7 +176,7 @@ Use the colon to define [Haml filters](http://haml.info/docs/yardoc/file.REFEREN
176176
console.log('This is inline script');
177177
```
178178

179-
### Use curly braces
179+
## Use curly braces
180180

181181
The name of the game here is readability and a big part of readability is DRY.
182182

@@ -206,7 +206,7 @@ Note that you can also pass in hashes directly into the data attribute, and it w
206206
.profile(data-name='Popeye' data-favorite-food='Spinach') Loading
207207
```
208208

209-
### Use alternative expression methods
209+
## Use alternative expression methods
210210

211211
At this point, you know exactly what `-` and `=` do in your HAML views, but what about the other fun Ruby expression outputting methods? These alternative outputting methods have got to be some of the most underused features of HAML, yet is one of the most useful, especially for internal communication.
212212

@@ -256,6 +256,6 @@ When you don’t know about interpolated Ruby code, you’re bound to pull this
256256

257257
Don’t bother with these strings – just cut right into the interpolated input expressed above and save characters and eye strain.
258258

259-
### HAML Cheat-Sheet
259+
## HAML Cheat-Sheet
260260

261261
* https://www.cheatography.com/specialbrand/cheat-sheets/haml/

sass-style-guide.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,8 @@ Zum Testen unseres Sass-Codes benutzen wir [Sass Lint](https://github.com/sassto
183183
Die Verwendung des Linters für neue Projekte ist **Pflicht**, damit Styleguide-Fragen in dem Projekt gar kein Thema werden.
184184

185185
* Dafür sollte jeder Entwickelnde lokal [die Editor-Integration](https://github.com/sasstools/sass-lint#ide-integration) verwenden, damit Fehler frühestmöglich erkannt werden.
186-
* Falls die Editor-Integration keine Option sein sollte, bliebe auch die Möglichkeit eines Pre-Commit-Hooks.
187-
* Als zusätzliches Sicherheitsnetz sollte ein Check auf Pull-Request-Ebene existieren.
188-
*(Hierfür testen wir gerade die TravisCI-Integration.)*
186+
* Falls die Editor-Integration keine Option sein sollte, bliebe auch die Möglichkeit eines Pre-Commit-Hooks.
187+
* Als zusätzliches Sicherheitsnetz sollte ein Check auf Pull-Request-Ebene existieren. Hierfür stellen wir eine TravisCI-Integration zur Verfügung.
189188

190189
### Installation
191190

0 commit comments

Comments
 (0)