You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# Zweitag Approach to Scalable and Adaptable Frontends (ZASAF)
2
2
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.
4
6
5
7
ZASAF folgt dem Grundgedanken von [BEM](http://getbem.com/) und [SMACSS](http://smacss.com), dass Frontends modular aufgebaut werden sollten.
6
8
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
140
142
.fact-list__entry
141
143
list-style-type: discline-height: 1.2
142
144
.fact-list__entry--highlighted
143
-
font-weight: bold
145
+
font-weight: 700
144
146
</pre>
145
147
</td>
146
148
<td>
@@ -150,14 +152,14 @@ Die Syntax von BEM finden wir jedoch etwas sperrig und haben uns für ein andere
150
152
.fact-list--entry
151
153
line-height: 1.2
152
154
&.highlighted
153
-
font-weight: bold
155
+
font-weight: 700
154
156
</pre>
155
157
</td>
156
158
</tr>
157
159
</table>
158
160
159
161
* 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.
161
163
162
164
### Beispiel
163
165
@@ -211,11 +213,15 @@ Die Syntax von BEM finden wir jedoch etwas sperrig und haben uns für ein andere
211
213
+column(8)
212
214
```
213
215
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
+
214
220
## Globales und Hilfsmittel
215
221
216
222
### Globales
217
223
218
-
Im Order `globals`finden sich globale Basisstile und Konfigurationen:
224
+
Im Order `globals`befinden sich globale Basisstile und Konfigurationen:
219
225
220
226
*_base.css.sass: Styling der HTML-Elemente (z.B. `strong {font-weight: 700}`)
Copy file name to clipboardExpand all lines: css-best-practices.md
+25-1Lines changed: 25 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# CSS Best Practices
2
2
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
+
3
5
## Selektorregeln
4
6
5
7
### Vermeide zu generische Selektoren
@@ -74,20 +76,42 @@ a.back
74
76
75
77
### Vermeide Nachfahrenselektoren
76
78
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.
78
80
79
81
**schlecht**
80
82
81
83
```sass
82
84
.link-list li a
83
85
```
84
86
87
+
**genauso schlecht**
88
+
89
+
```sass
90
+
.link-list .link-list--link
91
+
```
92
+
85
93
**gut**
86
94
87
95
```sass
88
96
.link-list--link
89
97
```
90
98
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
+
91
115
### Vermeide den selben Selektor fürs Styling (CSS) und fürs Verhalten (JS) zu verwenden
92
116
93
117
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.
Copy file name to clipboardExpand all lines: haml-style-guide.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
##HAML best practices
1
+
# HAML Styleguide
2
2
3
3
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.
4
4
5
-
###How to use HTML elements
5
+
## How to use HTML elements
6
6
7
7
To write your tags, use the percent sign followed by the name of the tag
8
8
@@ -30,7 +30,7 @@ If you want to add multiple classes, simply chain them:
30
30
.container.large.unobtrusive
31
31
```
32
32
33
-
###How to use comments
33
+
## How to use comments
34
34
35
35
There’re three different styles to write comments in Haml.
36
36
@@ -56,11 +56,11 @@ There’re three different styles to write comments in Haml.
56
56
57
57
**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.
58
58
59
-
###Use blocks
59
+
## Use blocks
60
60
61
61
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.
62
62
63
-
####Morph code into block format with `precede`, `succeed` and `surround`
63
+
### Morph code into block format with `precede`, `succeed` and `surround`
64
64
65
65
**Example:**
66
66
@@ -93,7 +93,7 @@ Using inline HTML and `content_tag`
93
93
94
94
This isn’t terrible, but the above blocks are much more readable!
95
95
96
-
####Use `link_to` as a block
96
+
### Use `link_to` as a block
97
97
98
98
When wrapping long or multiple elements in a link tag, It’s wise to use `link_to` in block format.
99
99
@@ -125,7 +125,7 @@ Rails routing is best used with its built-in helper methods, where objects can b
125
125
%a{href: users_path(@user)} View User Profile
126
126
```
127
127
128
-
####Use `list_of`
128
+
### Use `list_of`
129
129
130
130
A lesser known – and thus, lesser used – feature of HAML is `list_of`.
131
131
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.
158
158
= link_to student.name, [course, student]
159
159
```
160
160
161
-
###Use filters
161
+
## Use filters
162
162
163
163
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.
164
164
@@ -176,7 +176,7 @@ Use the colon to define [Haml filters](http://haml.info/docs/yardoc/file.REFEREN
176
176
console.log('This is inline script');
177
177
```
178
178
179
-
###Use curly braces
179
+
## Use curly braces
180
180
181
181
The name of the game here is readability and a big part of readability is DRY.
182
182
@@ -206,7 +206,7 @@ Note that you can also pass in hashes directly into the data attribute, and it w
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.
212
212
@@ -256,6 +256,6 @@ When you don’t know about interpolated Ruby code, you’re bound to pull this
256
256
257
257
Don’t bother with these strings – just cut right into the interpolated input expressed above and save characters and eye strain.
Copy file name to clipboardExpand all lines: sass-style-guide.md
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -183,9 +183,8 @@ Zum Testen unseres Sass-Codes benutzen wir [Sass Lint](https://github.com/sassto
183
183
Die Verwendung des Linters für neue Projekte ist **Pflicht**, damit Styleguide-Fragen in dem Projekt gar kein Thema werden.
184
184
185
185
* 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.
0 commit comments