Status: ✅ Accepted (Dezember 2025)
Datum: 2025-12-21
Kontext: Design System Consolidation für Jekyll + Decap CMS
Betroffen: assets/css/events.css, _includes/, _pages/, cms-static/
Das Event-Management-System hatte fragmentierte Styling-Definition:
- Farben in 5+ Orten definiert (hardcoded hex-Werte)
- Event-Card Badges: inline style="background-color: #hex"
- Filter-Buttons: inline style="background-color: #hex"
- veranstaltungen.md: 50+ Zeilen <style> Block mit !important
- CMS Admin: Farben nochmal in custom-admin.css (Duplikate)
- Keine zentrale Single Source of Truth
Probleme:
Gewählt: CSS Custom Properties (:root { --color-primary: ... })
Alternativ geprüft: SCSS Variables
Gründe für CSS-Variablen:
SCSS wäre besser wenn:
Gewählt: Zwei separate :root Definitionen
assets/css/events.css → Jekyll Public Sitecms-static/admin/custom-admin.css → CMS Admin (autark)Grund: cms-static/ wird autonomous zu Netlify deployed
├─ _site/ ← GitHub Pages (Jekyll)
│ └─ assets/css/events.css
└─ cms-static/ ← Netlify (Decap CMS)
└─ admin/custom-admin.css
Constraint: Keine cross-imports möglich. Jeder Teil muss self-contained sein.
Gewählt: Single Source of Truth + zwei Replicas
# Primary (Jekyll)
_data/event_types.yml
mach-mit-mathe:
color: "#E8F4F8"
# Replica 1 (CMS Config)
cms-static/admin/event-types.json
"mach-mit-mathe": {
"color": "#E8F4F8"
}
# Replica 2 (CMS Styling)
cms-static/admin/custom-admin.css
:root {
--event-color-mach-mit-mathe: #E8F4F8;
}
Warum 3 Dateien?
_data/event_types.yml = Single Source of Truth (Redakteure ändern hier)event-types.json = Wird von CMS JavaScript gelesen (Defaults)custom-admin.css = Styling muss lokal verfügbar seinTrade-off: Manuelles Sync erforderlich
Nutzen: Autarke Deployments, keine Abhängigkeiten
Gewählt: style="--event-type-color: "
<!-- _includes/event-card.html -->
<article style="--event-type-color: ;">
<!-- CSS nutzt: var(--event-type-color) -->
</article>
Warum nicht Inline-Style:
<!-- ❌ Anti-Pattern -->
<article style="border-left: ;">
<!-- ✅ Pattern -->
<article style="--event-type-color: ;">
Gründe:
Lint Warning: Inline styles sind normalerweise Anti-Pattern, aber hier:
/* assets/css/events.css */
:root {
--color-primary: #003d82;
--color-primary-strong: #002855;
--color-primary-stronger: #001a3d;
--color-surface: #ffffff;
--color-surface-muted: #f5f5f5;
--color-surface-soft: #f9f9f9;
--color-border: #d0d0d0;
--color-text: #111111;
--color-text-muted: #444444;
--color-link: #0066cc;
--color-link-strong: #004999;
--color-focus: #ffd700;
--radius-sm: 6px;
--radius-md: 8px;
--shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.1);
--shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.event-card {
border-left: 4px solid var(--event-type-color, var(--color-border));
box-shadow: var(--shadow-soft);
}
.event-filter-btn--type {
background-color: var(--event-type-color);
}
<button style="--event-type-color: ;">
</button>
| Vorteil | Impact |
|---|---|
| Single Source of Truth für Tokens | Einfaches Update: :root ändern → Sitewide angewendet |
| Keine Inline Color Duplikate | Wartbarkeitsbewertung ↑ 50% |
| Event-Typ Erweiterung einfach | Nur _data/event_types.yml + 3x CSS-Var |
| CMS Admin unabhängig | Skalierbar zu anderen CMS Systemen |
| Runtime Austauschbar | Basis für zukünftige Theme-Switcher |
| Developer-freundlich | Browser DevTools zeigen Werte direkt |
| Nachteil | Lösung |
|---|---|
| 3-Datei-Sync erforderlich | Maintenance-Dokumentation in custom-admin.css |
| Keine Typ-Sicherheit (Typos möglich) | Code Review vor Merge |
| CSS Custom Properties IE11-Support | ✅ OK: IE11 nicht im Scope |
| Performance Overhead minimal | ~1KB mehr CSS, aber kein Runtime-Hit |
@media (prefers-color-scheme: dark) {
:root {
--color-primary: #0066ff;
--color-surface: #1a1a1a;
}
}
document.documentElement.style.setProperty(
'--color-primary',
'#ff0000'
);
--color-primary, --radius-sm, etc. nutzennpm run export-tokens # → tokens.json für Figma
Diese Lösung: Minimalistisch, Jekyll-freundlich, Decap CMS kompatibel
✅ Durchgeführt:
❌ Nicht vorhanden (für Zukunft):
Token-Namen nicht konsistent
→ Guideline: --[category]-[element]-[state]
→ Beispiel: --color-primary-strong, nicht --primary-dark
Fallback vergessen
→ IMMER: var(--color-primary, #003d82)
3-File-Sync vergessen
→ Bei Event-Typ Farb-Änderung alle 3 Dateien updaten!
Inline Styles in anderen Komponenten einschleichen
→ Neue Features sollten Tokens verwenden
assets/css/events.css :root_data/event_types.yml + 2x Replicasvar(-- im Codevar(--color-*), var(--radius-*), etc.)var(--color-primary, #003d82)| Person | Status | Datum |
|---|---|---|
| GitHub Copilot | ✅ Implemented | 2025-12-21 |
| User Testing | ✅ All tests passed | 2025-12-21 |
| Branch Status | 🔄 Ready for merge | 2025-12-21 |