@marioschmidt/design-system-tokens 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +549 -493
- package/dist/android/res/values/brands/bild/semantic/color/colormode-dark.xml +1 -1
- package/dist/android/res/values/brands/bild/semantic/color/colormode-light.xml +1 -1
- package/dist/android/res/values/brands/sportbild/semantic/color/colormode-dark.xml +1 -1
- package/dist/android/res/values/brands/sportbild/semantic/color/colormode-light.xml +1 -1
- package/dist/css/brands/advertorial/semantic/effects/effects-dark.css +1 -1
- package/dist/css/brands/advertorial/semantic/effects/effects-light.css +1 -1
- package/dist/css/brands/advertorial/semantic/typography/typography-lg.css +1 -1
- package/dist/css/brands/advertorial/semantic/typography/typography-md.css +1 -1
- package/dist/css/brands/advertorial/semantic/typography/typography-sm.css +1 -1
- package/dist/css/brands/advertorial/semantic/typography/typography-xs.css +1 -1
- package/dist/css/brands/bild/semantic/color/colormode-dark.css +1 -1
- package/dist/css/brands/bild/semantic/color/colormode-light.css +1 -1
- package/dist/css/brands/bild/semantic/effects/effects-dark.css +1 -1
- package/dist/css/brands/bild/semantic/effects/effects-light.css +1 -1
- package/dist/css/brands/bild/semantic/typography/typography-lg.css +1 -1
- package/dist/css/brands/bild/semantic/typography/typography-md.css +1 -1
- package/dist/css/brands/bild/semantic/typography/typography-sm.css +1 -1
- package/dist/css/brands/bild/semantic/typography/typography-xs.css +1 -1
- package/dist/css/brands/sportbild/semantic/color/colormode-dark.css +1 -1
- package/dist/css/brands/sportbild/semantic/color/colormode-light.css +1 -1
- package/dist/css/brands/sportbild/semantic/effects/effects-dark.css +1 -1
- package/dist/css/brands/sportbild/semantic/effects/effects-light.css +1 -1
- package/dist/css/brands/sportbild/semantic/typography/typography-lg.css +1 -1
- package/dist/css/brands/sportbild/semantic/typography/typography-md.css +1 -1
- package/dist/css/brands/sportbild/semantic/typography/typography-sm.css +1 -1
- package/dist/css/brands/sportbild/semantic/typography/typography-xs.css +1 -1
- package/dist/flutter/brands/bild/semantic/color/colormode-dark.dart +1 -1
- package/dist/flutter/brands/bild/semantic/color/colormode-light.dart +1 -1
- package/dist/flutter/brands/sportbild/semantic/color/colormode-dark.dart +1 -1
- package/dist/flutter/brands/sportbild/semantic/color/colormode-light.dart +1 -1
- package/dist/ios/brands/bild/semantic/color/ColormodeDark.swift +1 -1
- package/dist/ios/brands/bild/semantic/color/ColormodeLight.swift +1 -1
- package/dist/ios/brands/sportbild/semantic/color/ColormodeDark.swift +1 -1
- package/dist/ios/brands/sportbild/semantic/color/ColormodeLight.swift +1 -1
- package/dist/js/brands/bild/semantic/color/colormode-dark.js +1 -2
- package/dist/js/brands/bild/semantic/color/colormode-light.js +1 -2
- package/dist/js/brands/sportbild/semantic/color/colormode-dark.js +1 -2
- package/dist/js/brands/sportbild/semantic/color/colormode-light.js +1 -2
- package/dist/json/brands/bild/semantic/color/colormode-dark.json +41 -41
- package/dist/json/brands/bild/semantic/color/colormode-light.json +41 -41
- package/dist/json/brands/sportbild/semantic/color/colormode-dark.json +41 -41
- package/dist/json/brands/sportbild/semantic/color/colormode-light.json +41 -41
- package/dist/manifest.json +1 -1
- package/dist/scss/brands/bild/semantic/color/colormode-dark.scss +1 -1
- package/dist/scss/brands/bild/semantic/color/colormode-light.scss +1 -1
- package/dist/scss/brands/sportbild/semantic/color/colormode-dark.scss +1 -1
- package/dist/scss/brands/sportbild/semantic/color/colormode-light.scss +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
# 🎨 BILD Design System - Token Pipeline
|
|
2
2
|
|
|
3
|
-
A comprehensive token transformation pipeline based on **Style Dictionary v4** for the BILD Design System. This pipeline transforms
|
|
3
|
+
A comprehensive multi-platform token transformation pipeline based on **Style Dictionary v4** for the BILD Design System. This pipeline transforms design tokens from a custom Figma plugin export into consumable formats across 7 platforms, 3 brands, and multiple modes.
|
|
4
4
|
|
|
5
5
|
## 📋 Table of Contents
|
|
6
6
|
|
|
7
7
|
- [Overview](#overview)
|
|
8
8
|
- [Features](#features)
|
|
9
|
-
- [Token Architecture](#token-architecture)
|
|
10
9
|
- [Installation](#installation)
|
|
11
|
-
- [
|
|
10
|
+
- [Quick Start](#quick-start)
|
|
11
|
+
- [Token Architecture](#token-architecture)
|
|
12
12
|
- [Output Structure](#output-structure)
|
|
13
|
-
- [
|
|
13
|
+
- [Platform Usage](#platform-usage)
|
|
14
|
+
- [Development](#development)
|
|
14
15
|
- [CI/CD Integration](#cicd-integration)
|
|
15
16
|
- [Troubleshooting](#troubleshooting)
|
|
16
17
|
|
|
@@ -18,25 +19,30 @@ A comprehensive token transformation pipeline based on **Style Dictionary v4** f
|
|
|
18
19
|
|
|
19
20
|
## 🎯 Overview
|
|
20
21
|
|
|
21
|
-
This token pipeline processes the multi-layer, multi-brand architecture of the BILD Design System with full support for
|
|
22
|
+
This token pipeline processes the multi-layer, multi-brand architecture of the BILD Design System with full support for:
|
|
23
|
+
- **3 Brands**: BILD, SportBILD, Advertorial
|
|
24
|
+
- **7 Platforms**: CSS, SCSS, JavaScript, JSON, iOS (Swift), Android (XML), Flutter (Dart)
|
|
25
|
+
- **Multiple Modes**: Density (3), Breakpoints (4), Color Modes (2)
|
|
26
|
+
- **Composite Tokens**: Typography, Effects
|
|
22
27
|
|
|
23
28
|
```
|
|
24
|
-
Figma
|
|
29
|
+
Custom Figma Plugin Export (JSON)
|
|
25
30
|
↓
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
Preprocessing (scripts/preprocess-plugin-tokens.js)
|
|
32
|
+
• Complete alias resolution (no {Alias.Path} syntax)
|
|
33
|
+
• Context-aware resolution: Brand × Breakpoint × ColorMode
|
|
34
|
+
• Mode name matching (robust against ID changes)
|
|
35
|
+
• FontWeight bug fixes ("700px" → 700)
|
|
30
36
|
↓
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
Style Dictionary v4 (scripts/build-tokens-v2.js)
|
|
38
|
+
• Multi-platform output (7 formats)
|
|
39
|
+
• Brand-specific builds
|
|
40
|
+
• Composite token support (Typography, Effects)
|
|
35
41
|
↓
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
Output Files (dist/)
|
|
43
|
+
• css/, scss/, js/, json/, ios/, android/, flutter/
|
|
44
|
+
• shared/ (primitives) + brands/{brand}/ (brand-specific)
|
|
45
|
+
• 52/52 successful builds
|
|
40
46
|
```
|
|
41
47
|
|
|
42
48
|
---
|
|
@@ -45,385 +51,275 @@ Figma Tokens (JSON)
|
|
|
45
51
|
|
|
46
52
|
### Pipeline Features
|
|
47
53
|
|
|
48
|
-
✅ **
|
|
49
|
-
✅ **
|
|
50
|
-
✅ **Brand
|
|
51
|
-
✅ **
|
|
52
|
-
✅ **
|
|
53
|
-
✅ **
|
|
54
|
-
✅ **
|
|
55
|
-
✅ **
|
|
54
|
+
✅ **Complete Alias Resolution**: All `VARIABLE_ALIAS` references resolved to final values in preprocessing
|
|
55
|
+
✅ **7 Platform Support**: CSS, SCSS, JavaScript, JSON, iOS Swift, Android XML, Flutter Dart
|
|
56
|
+
✅ **Multi-Brand Architecture**: BILD, SportBILD, Advertorial with brand-specific token resolution
|
|
57
|
+
✅ **Composite Tokens**: Typography (12 outputs: 3 brands × 4 breakpoints), Effects (6 outputs: 3 brands × 2 color modes)
|
|
58
|
+
✅ **Context-Aware Resolution**: Brand × Breakpoint × ColorMode matrix processing
|
|
59
|
+
✅ **Advertorial Special Handling**: No color/ folder (no BrandColorMapping)
|
|
60
|
+
✅ **Size Class Mapping**: iOS/Android only generate compact (sm) and regular (lg) with sizeclass terminology
|
|
61
|
+
✅ **Zero Reference Errors**: All aliases fully resolved before Style Dictionary
|
|
56
62
|
|
|
57
|
-
###
|
|
63
|
+
### Build Statistics
|
|
58
64
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
- **52/52 builds successful** across all platforms
|
|
66
|
+
- 4 Shared Primitives (Color, Font, Size, Space)
|
|
67
|
+
- 30 Brand-specific Tokens (3 brands × 10 token sets)
|
|
68
|
+
- 12 Typography Builds (3 brands × 4 breakpoints)
|
|
69
|
+
- 6 Effect Builds (3 brands × 2 color modes)
|
|
63
70
|
|
|
64
71
|
---
|
|
65
72
|
|
|
66
73
|
## 📦 Installation
|
|
67
74
|
|
|
68
|
-
###
|
|
69
|
-
|
|
70
|
-
This package is published to **GitHub Packages** as `@uxwizard25/design-system-tokens`.
|
|
75
|
+
### Prerequisites
|
|
71
76
|
|
|
72
|
-
|
|
77
|
+
- Node.js >= 20.x
|
|
78
|
+
- npm >= 10.x
|
|
73
79
|
|
|
74
|
-
|
|
80
|
+
### Setup
|
|
75
81
|
|
|
76
82
|
```bash
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
#### 2. Authenticate with GitHub
|
|
82
|
-
|
|
83
|
-
Create a Personal Access Token (PAT):
|
|
84
|
-
|
|
85
|
-
1. Go to: https://github.com/settings/tokens
|
|
86
|
-
2. Click **"Generate new token (classic)"**
|
|
87
|
-
3. Name: `npm-packages-read`
|
|
88
|
-
4. Scopes: Select `read:packages`
|
|
89
|
-
5. Click **"Generate token"**
|
|
90
|
-
6. Copy the token
|
|
83
|
+
# Clone repository
|
|
84
|
+
git clone https://github.com/UXWizard25/vv-token-test-v3.git
|
|
85
|
+
cd vv-token-test-v3
|
|
91
86
|
|
|
92
|
-
|
|
87
|
+
# Install dependencies
|
|
88
|
+
npm install
|
|
93
89
|
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
# Build tokens
|
|
91
|
+
npm run build
|
|
96
92
|
```
|
|
97
93
|
|
|
98
|
-
|
|
94
|
+
---
|
|
99
95
|
|
|
100
|
-
|
|
101
|
-
export GITHUB_TOKEN="ghp_YOUR_TOKEN_HERE"
|
|
102
|
-
```
|
|
96
|
+
## 🚀 Quick Start
|
|
103
97
|
|
|
104
|
-
|
|
98
|
+
### Build Tokens
|
|
105
99
|
|
|
106
100
|
```bash
|
|
107
|
-
#
|
|
108
|
-
npm
|
|
109
|
-
|
|
110
|
-
# Specific version
|
|
111
|
-
npm install @uxwizard25/design-system-tokens@1.2.3
|
|
112
|
-
|
|
113
|
-
# As dev dependency
|
|
114
|
-
npm install --save-dev @uxwizard25/design-system-tokens
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
#### 4. Use in Your Project
|
|
118
|
-
|
|
119
|
-
**CSS:**
|
|
120
|
-
```css
|
|
121
|
-
/* Import in your main CSS file */
|
|
122
|
-
@import '@uxwizard25/design-system-tokens/css/semantic/bild/color/color-bild-light.css';
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
**SCSS:**
|
|
126
|
-
```scss
|
|
127
|
-
// Import in your SCSS file
|
|
128
|
-
@import '@uxwizard25/design-system-tokens/scss/semantic/bild/color/color-bild-light';
|
|
101
|
+
# Full build (preprocessing + build)
|
|
102
|
+
npm run build
|
|
129
103
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
104
|
+
# Or run steps separately:
|
|
105
|
+
npm run preprocess # Custom Plugin JSON → Style Dictionary format
|
|
106
|
+
npm run build:tokens # Style Dictionary → Platform outputs
|
|
133
107
|
```
|
|
134
108
|
|
|
135
|
-
|
|
136
|
-
```javascript
|
|
137
|
-
// Import tokens as JS module
|
|
138
|
-
import tokens from '@uxwizard25/design-system-tokens/json/semantic/bild/color/color-bild-light.json';
|
|
139
|
-
|
|
140
|
-
console.log(tokens.color.brand.primary); // "#de0000"
|
|
141
|
-
```
|
|
109
|
+
### Watch Mode (Development)
|
|
142
110
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
// In your main.js or main.ts
|
|
146
|
-
import '@uxwizard25/design-system-tokens/css/semantic/bild/color/color-bild-light.css';
|
|
111
|
+
```bash
|
|
112
|
+
npm run watch
|
|
147
113
|
```
|
|
148
114
|
|
|
149
|
-
###
|
|
150
|
-
|
|
151
|
-
If you want to develop the token pipeline itself:
|
|
115
|
+
### Clean Generated Files
|
|
152
116
|
|
|
153
117
|
```bash
|
|
154
|
-
|
|
155
|
-
git clone https://github.com/UXWizard25/vv-token-test-v3.git
|
|
156
|
-
cd vv-token-test-v3
|
|
157
|
-
|
|
158
|
-
# Install dependencies
|
|
159
|
-
npm install
|
|
160
|
-
|
|
161
|
-
# Build tokens
|
|
162
|
-
npm run build
|
|
163
|
-
|
|
164
|
-
# Watch mode (auto-rebuild on changes)
|
|
165
|
-
npm run watch
|
|
118
|
+
npm run clean
|
|
166
119
|
```
|
|
167
120
|
|
|
168
121
|
---
|
|
169
122
|
|
|
170
123
|
## 🏗️ Token Architecture
|
|
171
124
|
|
|
172
|
-
### Layer Structure
|
|
125
|
+
### Multi-Layer Structure
|
|
173
126
|
|
|
174
127
|
The Design System is organized in four layers:
|
|
175
128
|
|
|
176
|
-
#### 1️⃣ **
|
|
177
|
-
|
|
178
|
-
Foundation tokens without modes (only "Value" mode).
|
|
129
|
+
#### 1️⃣ **Shared Primitives** - Foundation Tokens
|
|
179
130
|
|
|
180
|
-
|
|
181
|
-
- **`_SpacePrimitive`**: Base spacing scale
|
|
182
|
-
- **`_SizePrimitive`**: Base size scale
|
|
183
|
-
- **`_FontPrimitive`**: Base typography
|
|
131
|
+
Base tokens without brand context (single mode: "Value").
|
|
184
132
|
|
|
185
133
|
**Collections:**
|
|
186
|
-
- `
|
|
187
|
-
- `
|
|
188
|
-
- `
|
|
189
|
-
- `
|
|
134
|
+
- `_FontPrimitive` → Font families, weights, letter spacing
|
|
135
|
+
- `_ColorPrimitive` → Base color palette
|
|
136
|
+
- `_SizePrimitive` → Base size scale
|
|
137
|
+
- `_SpacePrimitive` → Base spacing scale
|
|
190
138
|
|
|
191
139
|
**Output:**
|
|
192
140
|
```
|
|
193
|
-
dist/
|
|
194
|
-
├──
|
|
195
|
-
├──
|
|
196
|
-
├──
|
|
197
|
-
└──
|
|
141
|
+
dist/{platform}/shared/
|
|
142
|
+
├── fontprimitive.*
|
|
143
|
+
├── colorprimitive.*
|
|
144
|
+
├── sizeprimitive.*
|
|
145
|
+
└── spaceprimitive.*
|
|
198
146
|
```
|
|
199
147
|
|
|
200
|
-
#### 2️⃣ **
|
|
148
|
+
#### 2️⃣ **Brand-Specific Tokens** - Density & Overrides
|
|
201
149
|
|
|
202
|
-
|
|
150
|
+
Brand context tokens with multiple modes.
|
|
203
151
|
|
|
204
|
-
|
|
205
|
-
-
|
|
152
|
+
**Density Collection** (3 modes):
|
|
153
|
+
- compact, default, spacious
|
|
206
154
|
|
|
207
|
-
**
|
|
208
|
-
-
|
|
209
|
-
-
|
|
155
|
+
**Brand Overrides** (3 brands):
|
|
156
|
+
- BrandTokenMapping: BILD, SportBILD, Advertorial
|
|
157
|
+
- BrandColorMapping: BILD, SportBILD (⚠️ Advertorial has no BrandColorMapping)
|
|
210
158
|
|
|
211
159
|
**Output:**
|
|
212
160
|
```
|
|
213
|
-
dist/
|
|
214
|
-
├──
|
|
215
|
-
├──
|
|
216
|
-
├──
|
|
217
|
-
|
|
218
|
-
└──
|
|
161
|
+
dist/{platform}/brands/{brand}/
|
|
162
|
+
├── density/
|
|
163
|
+
│ ├── density-compact.*
|
|
164
|
+
│ ├── density-default.*
|
|
165
|
+
│ └── density-spacious.*
|
|
166
|
+
└── overrides/
|
|
167
|
+
├── brandtokenmapping.*
|
|
168
|
+
└── brandcolormapping.* # Only BILD & SportBILD
|
|
219
169
|
```
|
|
220
170
|
|
|
221
|
-
#### 3️⃣ **
|
|
171
|
+
#### 3️⃣ **Semantic Tokens** - Brand × Mode Matrix
|
|
222
172
|
|
|
223
|
-
|
|
173
|
+
Context-specific tokens with brand and mode variations.
|
|
224
174
|
|
|
225
|
-
|
|
175
|
+
**BreakpointMode** (4 modes per brand):
|
|
176
|
+
- xs (320px), sm (390px, compact), md (600px), lg (1024px, regular)
|
|
226
177
|
|
|
227
|
-
**
|
|
228
|
-
-
|
|
178
|
+
**ColorMode** (2 modes per brand):
|
|
179
|
+
- light, dark
|
|
229
180
|
|
|
230
181
|
**Output:**
|
|
231
182
|
```
|
|
232
|
-
dist/
|
|
233
|
-
├──
|
|
234
|
-
├──
|
|
235
|
-
|
|
183
|
+
dist/{platform}/brands/{brand}/semantic/
|
|
184
|
+
├── breakpoints/
|
|
185
|
+
│ ├── breakpoint-xs-320px.*
|
|
186
|
+
│ ├── breakpoint-sm-390px-compact.*
|
|
187
|
+
│ ├── breakpoint-md-600px.*
|
|
188
|
+
│ └── breakpoint-lg-1024px-regular.*
|
|
189
|
+
└── color/
|
|
190
|
+
├── colormode-light.*
|
|
191
|
+
└── colormode-dark.*
|
|
236
192
|
```
|
|
237
193
|
|
|
238
|
-
|
|
194
|
+
⚠️ **Note**: Advertorial has **no color/ folder** (no BrandColorMapping collection).
|
|
239
195
|
|
|
240
|
-
|
|
196
|
+
#### 4️⃣ **Composite Tokens** - Typography & Effects
|
|
241
197
|
|
|
242
|
-
|
|
243
|
-
- **`BreakpointMode`**: Modes: XS, SM, MD, LG (brand-specific)
|
|
198
|
+
Structured tokens with CSS classes for ready-to-use styles.
|
|
244
199
|
|
|
245
|
-
**
|
|
246
|
-
-
|
|
247
|
-
-
|
|
200
|
+
**Typography** (4 breakpoints per brand):
|
|
201
|
+
- 3 brands × 4 breakpoints = **12 outputs**
|
|
202
|
+
- CSS: Ready-to-use classes (`.headline1`, `.body1`, etc.)
|
|
203
|
+
- iOS/Android: Only compact (sm) and regular (lg) with sizeclass terminology
|
|
248
204
|
|
|
249
|
-
**
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
│ ├── color/
|
|
254
|
-
│ │ ├── color-bild-light.css # BILD brand with #de0000
|
|
255
|
-
│ │ └── color-bild-dark.css
|
|
256
|
-
│ └── breakpoints/
|
|
257
|
-
│ ├── breakpoint-bild-xs.css
|
|
258
|
-
│ ├── breakpoint-bild-sm.css
|
|
259
|
-
│ ├── breakpoint-bild-md.css
|
|
260
|
-
│ └── breakpoint-bild-lg.css
|
|
261
|
-
├── sportbild/
|
|
262
|
-
│ ├── color/
|
|
263
|
-
│ │ ├── color-sportbild-light.css # SportBILD brand with #0a264f
|
|
264
|
-
│ │ └── color-sportbild-dark.css
|
|
265
|
-
│ └── breakpoints/
|
|
266
|
-
│ └── ...
|
|
267
|
-
└── advertorial/
|
|
268
|
-
├── color/
|
|
269
|
-
│ ├── color-advertorial-light.css
|
|
270
|
-
│ └── color-advertorial-dark.css
|
|
271
|
-
└── breakpoints/
|
|
272
|
-
└── ...
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
**Key Feature:** Each brand directory contains fully resolved token values specific to that brand. Cross-collection aliases (e.g., from `ColorMode` → `BrandColorMapping`) are resolved correctly per brand during preprocessing.
|
|
205
|
+
**Effects** (2 color modes per brand):
|
|
206
|
+
- 3 brands × 2 color modes = **6 outputs**
|
|
207
|
+
- CSS: Shadow and blur effect classes
|
|
208
|
+
- All platforms: Effect token objects
|
|
276
209
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
## 📦 Installation
|
|
280
|
-
|
|
281
|
-
### Prerequisites
|
|
282
|
-
|
|
283
|
-
- Node.js >= 16.x
|
|
284
|
-
- npm >= 8.x
|
|
285
|
-
|
|
286
|
-
### Setup
|
|
287
|
-
|
|
288
|
-
```bash
|
|
289
|
-
# Install dependencies
|
|
290
|
-
npm install
|
|
291
|
-
|
|
292
|
-
# Or with pnpm/yarn
|
|
293
|
-
pnpm install
|
|
294
|
-
yarn install
|
|
210
|
+
**Output:**
|
|
295
211
|
```
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
npm run preprocess
|
|
306
|
-
|
|
307
|
-
# 2. Build: Tokens → Output files
|
|
308
|
-
npm run build:tokens
|
|
309
|
-
|
|
310
|
-
# Or both in one step:
|
|
311
|
-
npm run build
|
|
212
|
+
dist/{platform}/brands/{brand}/semantic/
|
|
213
|
+
├── typography/
|
|
214
|
+
│ ├── typography-xs.*
|
|
215
|
+
│ ├── typography-sm.*
|
|
216
|
+
│ ├── typography-md.*
|
|
217
|
+
│ └── typography-lg.*
|
|
218
|
+
└── effects/
|
|
219
|
+
├── effects-light.*
|
|
220
|
+
└── effects-dark.*
|
|
312
221
|
```
|
|
313
222
|
|
|
314
|
-
**
|
|
315
|
-
- ✅ 30/30 builds successful
|
|
316
|
-
- ✅ 0 warnings
|
|
317
|
-
- ✅ All aliases resolved correctly
|
|
318
|
-
- ✅ Brand-specific values verified
|
|
319
|
-
|
|
320
|
-
### Watch Mode (Development)
|
|
321
|
-
|
|
322
|
-
```bash
|
|
323
|
-
# Auto-rebuild on changes
|
|
324
|
-
npm run watch
|
|
223
|
+
**iOS/Android Size Classes:**
|
|
325
224
|
```
|
|
225
|
+
dist/ios/brands/{brand}/
|
|
226
|
+
├── sizeclass-compact/ # sm breakpoint
|
|
227
|
+
│ └── Typography.swift
|
|
228
|
+
└── sizeclass-regular/ # lg breakpoint
|
|
229
|
+
└── Typography.swift
|
|
326
230
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
#
|
|
331
|
-
|
|
231
|
+
dist/android/brands/{brand}/
|
|
232
|
+
├── sizeclass-compact/ # sm breakpoint
|
|
233
|
+
│ └── typography_styles.xml
|
|
234
|
+
└── sizeclass-regular/ # lg breakpoint
|
|
235
|
+
└── typography_styles.xml
|
|
332
236
|
```
|
|
333
237
|
|
|
334
238
|
---
|
|
335
239
|
|
|
336
240
|
## 📁 Output Structure
|
|
337
241
|
|
|
338
|
-
### Platform
|
|
242
|
+
### Platform Overview
|
|
339
243
|
|
|
340
244
|
```
|
|
341
245
|
dist/
|
|
342
|
-
├── manifest.json #
|
|
246
|
+
├── manifest.json # Build metadata
|
|
343
247
|
│
|
|
344
248
|
├── css/ # CSS Custom Properties
|
|
345
|
-
│ ├──
|
|
346
|
-
│
|
|
347
|
-
│ │ ├── primitive-color-value.css
|
|
348
|
-
│ │ ├── primitive-color-value-global.css
|
|
349
|
-
│ │ └── ...
|
|
350
|
-
│ ├── mapping/
|
|
351
|
-
│ │ ├── index.css
|
|
352
|
-
│ │ ├── brand-bild.css
|
|
353
|
-
│ │ └── ...
|
|
354
|
-
│ ├── density/
|
|
355
|
-
│ │ ├── index.css
|
|
356
|
-
│ │ └── ...
|
|
357
|
-
│ └── semantic/
|
|
249
|
+
│ ├── shared/ # Primitives (no brand context)
|
|
250
|
+
│ └── brands/
|
|
358
251
|
│ ├── bild/
|
|
359
|
-
│ │ ├── color/
|
|
360
|
-
│ │ │ ├── index.css
|
|
361
|
-
│ │ │ ├── color-bild-light.css
|
|
362
|
-
│ │ │ ├── color-bild-light-global.css
|
|
363
|
-
│ │ │ └── color-bild-dark.css
|
|
364
|
-
│ │ └── breakpoints/
|
|
365
|
-
│ │ ├── index.css
|
|
366
|
-
│ │ ├── breakpoint-bild-xs.css
|
|
367
|
-
│ │ └── ...
|
|
368
252
|
│ ├── sportbild/
|
|
369
|
-
│ │ └── ...
|
|
370
253
|
│ └── advertorial/
|
|
371
|
-
│ └── ...
|
|
372
254
|
│
|
|
373
255
|
├── scss/ # SCSS Variables (same structure)
|
|
374
256
|
├── js/ # JavaScript ES6 Modules (same structure)
|
|
375
|
-
|
|
257
|
+
├── json/ # JSON Data (same structure)
|
|
258
|
+
│
|
|
259
|
+
├── ios/ # Swift Classes
|
|
260
|
+
│ ├── shared/
|
|
261
|
+
│ └── brands/{brand}/
|
|
262
|
+
│ ├── density/
|
|
263
|
+
│ ├── overrides/
|
|
264
|
+
│ ├── semantic/
|
|
265
|
+
│ ├── sizeclass-compact/ # sm only
|
|
266
|
+
│ └── sizeclass-regular/ # lg only
|
|
267
|
+
│
|
|
268
|
+
├── android/ # Android XML Resources
|
|
269
|
+
│ ├── res/values/shared/
|
|
270
|
+
│ └── brands/{brand}/
|
|
271
|
+
│ └── sizeclass-{compact|regular}/
|
|
272
|
+
│
|
|
273
|
+
└── flutter/ # Flutter Dart Classes (same structure as CSS)
|
|
376
274
|
```
|
|
377
275
|
|
|
378
|
-
###
|
|
276
|
+
### Brand Directory Structure
|
|
277
|
+
|
|
278
|
+
Each brand contains:
|
|
379
279
|
|
|
380
|
-
|
|
280
|
+
```
|
|
281
|
+
brands/{brand}/
|
|
282
|
+
├── density/ # 3 files (compact, default, spacious)
|
|
283
|
+
├── overrides/ # 1-2 files (brandtokenmapping, brandcolormapping*)
|
|
284
|
+
└── semantic/
|
|
285
|
+
├── breakpoints/ # 4 files (xs, sm, md, lg)
|
|
286
|
+
├── color/ # 2 files (light, dark) - BILD & SportBILD only
|
|
287
|
+
├── effects/ # 2 files (light, dark)
|
|
288
|
+
└── typography/ # 4 files (xs, sm, md, lg)
|
|
289
|
+
```
|
|
381
290
|
|
|
382
|
-
|
|
383
|
-
|--------|-------|----------|---------|
|
|
384
|
-
| `.css` | Data attribute scoped | `[data-color="light"]` | Scoped contexts |
|
|
385
|
-
| `-global.css` | Root scoped | `:root` | Global application |
|
|
386
|
-
| `.scss` | SCSS variables | `$token-name` | Sass preprocessing |
|
|
387
|
-
| `.js` | ES6 module | `import tokens` | JavaScript apps |
|
|
388
|
-
| `.json` | Structured data | JSON | API/tooling |
|
|
291
|
+
⚠️ **Advertorial Exception**: No `color/` folder (no BrandColorMapping)
|
|
389
292
|
|
|
390
293
|
---
|
|
391
294
|
|
|
392
|
-
## 🎨 Usage
|
|
295
|
+
## 🎨 Platform Usage
|
|
393
296
|
|
|
394
297
|
### CSS
|
|
395
298
|
|
|
396
299
|
```css
|
|
397
300
|
/* Import brand-specific tokens */
|
|
398
|
-
@import '@
|
|
399
|
-
@import '@
|
|
400
|
-
|
|
401
|
-
/* Or use index files */
|
|
402
|
-
@import '@bild-ds/tokens/dist/css/semantic/bild/color/index.css';
|
|
403
|
-
|
|
404
|
-
/* Usage with data attributes */
|
|
405
|
-
[data-color="light"] {
|
|
406
|
-
background: var(--semantic-core-core-color-primary); /* #de0000 for BILD */
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
/* Or with global variant */
|
|
410
|
-
@import '@bild-ds/tokens/dist/css/semantic/bild/color/color-bild-light-global.css';
|
|
301
|
+
@import '@marioschmidt/design-system-tokens/css/brands/bild/semantic/color/colormode-light.css';
|
|
302
|
+
@import '@marioschmidt/design-system-tokens/css/brands/bild/semantic/typography/typography-md.css';
|
|
411
303
|
|
|
304
|
+
/* Use CSS custom properties */
|
|
412
305
|
.button {
|
|
413
|
-
background: var(--
|
|
306
|
+
background-color: var(--bild-red-bild-red); /* #DD0000 */
|
|
307
|
+
font-family: var(--font-family-bild-font-family-gotham-cond);
|
|
414
308
|
}
|
|
309
|
+
|
|
310
|
+
/* Use ready-made typography classes */
|
|
311
|
+
<h1 class="headline1">Headline</h1>
|
|
415
312
|
```
|
|
416
313
|
|
|
417
314
|
### SCSS
|
|
418
315
|
|
|
419
316
|
```scss
|
|
420
317
|
// Import brand-specific tokens
|
|
421
|
-
@import '@
|
|
318
|
+
@import '@marioschmidt/design-system-tokens/scss/brands/bild/semantic/color/colormode-light';
|
|
422
319
|
|
|
423
|
-
// Usage
|
|
424
320
|
.button {
|
|
425
|
-
background-color: $
|
|
426
|
-
padding: $
|
|
321
|
+
background-color: $bild-red-bild-red; // #DD0000
|
|
322
|
+
padding: $space-primitive-space2x;
|
|
427
323
|
}
|
|
428
324
|
```
|
|
429
325
|
|
|
@@ -431,130 +327,75 @@ Each token set generates multiple variants:
|
|
|
431
327
|
|
|
432
328
|
```javascript
|
|
433
329
|
// Import brand-specific tokens
|
|
434
|
-
import
|
|
435
|
-
import sportbildColorLight from '@bild-ds/tokens/dist/js/semantic/sportbild/color/color-sportbild-light.js';
|
|
330
|
+
import tokens from '@marioschmidt/design-system-tokens/js/brands/bild/semantic/color/colormode-light.js';
|
|
436
331
|
|
|
437
|
-
//
|
|
438
|
-
console.log(bildColorLight['semantic-core-core-color-primary']); // "#de0000"
|
|
439
|
-
|
|
440
|
-
// SportBILD brand
|
|
441
|
-
console.log(sportbildColorLight['semantic-core-core-color-primary']); // "#0a264f"
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
### React/Styled Components
|
|
445
|
-
|
|
446
|
-
```jsx
|
|
447
|
-
import bildTokens from '@bild-ds/tokens/dist/js/semantic/bild/color/color-bild-light.js';
|
|
332
|
+
console.log(tokens.BildRedBildRed); // "#dd0000"
|
|
448
333
|
|
|
334
|
+
// React/Styled Components
|
|
449
335
|
const Button = styled.button`
|
|
450
|
-
background-color: ${
|
|
451
|
-
color: ${bildTokens['semantic-core-core-fg-on-primary']};
|
|
336
|
+
background-color: ${tokens.BildRedBildRed};
|
|
452
337
|
`;
|
|
453
338
|
```
|
|
454
339
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
## ⚙️ Configuration
|
|
458
|
-
|
|
459
|
-
### Collection Configuration
|
|
460
|
-
|
|
461
|
-
Located in `scripts/build-tokens.js`:
|
|
340
|
+
### JSON
|
|
462
341
|
|
|
463
342
|
```javascript
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
layer: 'semantic',
|
|
467
|
-
category: 'color',
|
|
468
|
-
modes: ['light', 'dark'],
|
|
469
|
-
outputPrefix: 'color',
|
|
470
|
-
figmaCollectionId: 'VariableCollectionId:588:1979', // Stable ID
|
|
471
|
-
figmaCollectionName: 'ColorMode', // For logging only
|
|
472
|
-
brandSpecific: true,
|
|
473
|
-
brands: ['bild', 'sportbild', 'advertorial']
|
|
474
|
-
},
|
|
475
|
-
// ... more collections
|
|
476
|
-
};
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
**Key Points:**
|
|
480
|
-
- Uses **stable Collection IDs** from Figma (robust against renaming)
|
|
481
|
-
- `brandSpecific: true` generates separate files per brand
|
|
482
|
-
- `modeMapping` can transform mode names (e.g., `xs-320px` → `xs`)
|
|
483
|
-
|
|
484
|
-
### Brand-Specific Collections
|
|
485
|
-
|
|
486
|
-
Located in `scripts/preprocess-figma-tokens.js`:
|
|
343
|
+
// Import structured token data
|
|
344
|
+
import tokens from '@marioschmidt/design-system-tokens/json/brands/bild/semantic/color/colormode-light.json';
|
|
487
345
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
};
|
|
346
|
+
console.log(tokens);
|
|
347
|
+
// {
|
|
348
|
+
// "BildRed": {
|
|
349
|
+
// "bildRed": {
|
|
350
|
+
// "$type": "color",
|
|
351
|
+
// "$value": "#DD0000",
|
|
352
|
+
// "type": "color",
|
|
353
|
+
// "value": "#DD0000"
|
|
354
|
+
// }
|
|
355
|
+
// }
|
|
356
|
+
// }
|
|
500
357
|
```
|
|
501
358
|
|
|
502
|
-
|
|
503
|
-
1. During preprocessing, ColorMode tokens that reference BrandColorMapping
|
|
504
|
-
2. Are resolved **per brand** using the correct mode ID
|
|
505
|
-
3. Generate separate output files: `light-bild.json`, `light-sportbild.json`, etc.
|
|
359
|
+
### iOS (Swift)
|
|
506
360
|
|
|
507
|
-
|
|
361
|
+
```swift
|
|
362
|
+
// Import brand-specific tokens
|
|
363
|
+
import DesignTokens
|
|
508
364
|
|
|
509
|
-
|
|
365
|
+
// Use color tokens
|
|
366
|
+
let primaryColor = Colorprimitive.bildRedBildRed // UIColor
|
|
510
367
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
name: 'attribute/cti',
|
|
514
|
-
type: 'attribute',
|
|
515
|
-
transformer: (token) => {
|
|
516
|
-
// Custom transformation logic
|
|
517
|
-
}
|
|
518
|
-
});
|
|
368
|
+
// Use typography (size class aware)
|
|
369
|
+
let typography = Typography.headline1 // Typography struct
|
|
519
370
|
```
|
|
520
371
|
|
|
521
|
-
|
|
372
|
+
### Android (XML)
|
|
522
373
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
374
|
+
```xml
|
|
375
|
+
<!-- Import brand-specific colors -->
|
|
376
|
+
<resources>
|
|
377
|
+
<color name="bild_red_bild_red">#DD0000</color>
|
|
378
|
+
<dimen name="space_2x">16dp</dimen>
|
|
526
379
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
**Build Steps:**
|
|
536
|
-
1. Checkout repository
|
|
537
|
-
2. Setup Node.js
|
|
538
|
-
3. Install dependencies
|
|
539
|
-
4. Run preprocessing
|
|
540
|
-
5. Run build
|
|
541
|
-
6. Upload artifacts
|
|
380
|
+
<!-- Typography styles (size class aware) -->
|
|
381
|
+
<style name="Headline1" parent="TextAppearance.AppCompat">
|
|
382
|
+
<item name="android:fontFamily">@font/gotham_condensed</item>
|
|
383
|
+
<item name="android:textSize">48sp</item>
|
|
384
|
+
</style>
|
|
385
|
+
</resources>
|
|
386
|
+
```
|
|
542
387
|
|
|
543
|
-
|
|
544
|
-
- Name: `design-tokens-{commit-sha}`
|
|
545
|
-
- Retention: 30 days
|
|
546
|
-
- Contains: All generated files
|
|
388
|
+
### Flutter (Dart)
|
|
547
389
|
|
|
548
|
-
|
|
390
|
+
```dart
|
|
391
|
+
// Import brand-specific tokens
|
|
392
|
+
import 'package:design_tokens/brands/bild/semantic/color/colormode_light.dart';
|
|
549
393
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
2. Select **"Build Design Tokens"**
|
|
553
|
-
3. Click **"Run workflow"**
|
|
394
|
+
// Use color tokens
|
|
395
|
+
final primaryColor = Colorprimitive.bildRedBildRed; // Color
|
|
554
396
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
gh workflow run build-tokens.yml
|
|
397
|
+
// Use typography tokens
|
|
398
|
+
final headline1 = Typography.headline1; // TypographyToken
|
|
558
399
|
```
|
|
559
400
|
|
|
560
401
|
---
|
|
@@ -567,43 +408,82 @@ gh workflow run build-tokens.yml
|
|
|
567
408
|
.
|
|
568
409
|
├── src/
|
|
569
410
|
│ └── design-tokens/
|
|
570
|
-
│ └──
|
|
411
|
+
│ └── bild-design-system-raw-data.json # Custom Figma Plugin export
|
|
571
412
|
│
|
|
572
413
|
├── scripts/
|
|
573
|
-
│ ├── preprocess-
|
|
574
|
-
│ │ • Alias resolution
|
|
575
|
-
│ │ •
|
|
576
|
-
│ │ • Mode ID
|
|
577
|
-
│ │ •
|
|
578
|
-
│
|
|
579
|
-
│
|
|
414
|
+
│ ├── preprocess-plugin-tokens.js # Preprocessing (965 lines)
|
|
415
|
+
│ │ • Alias resolution to final values
|
|
416
|
+
│ │ • Context-aware resolution (Brand × Breakpoint × ColorMode)
|
|
417
|
+
│ │ • Mode name matching (not ID-based)
|
|
418
|
+
│ │ • FontWeight bug fix ("700px" → 700)
|
|
419
|
+
│ │ • Advertorial special handling (no BrandColorMapping)
|
|
420
|
+
│ │
|
|
421
|
+
│ └── build-tokens-v2.js # Build orchestration (551 lines)
|
|
422
|
+
│ • Multi-platform configuration (7 formats)
|
|
580
423
|
│ • Brand-specific builds
|
|
581
|
-
│ •
|
|
424
|
+
│ • Composite token support (Typography, Effects)
|
|
425
|
+
│ • Size class mapping for iOS/Android
|
|
582
426
|
│
|
|
583
427
|
├── build-config/
|
|
584
|
-
│ └── style-dictionary.config.js
|
|
428
|
+
│ └── style-dictionary.config.js # Custom transforms & formats
|
|
429
|
+
│ • CSS typography classes format
|
|
430
|
+
│ • CSS effect classes format
|
|
431
|
+
│ • iOS Swift typography format
|
|
432
|
+
│ • Android typography XML format
|
|
585
433
|
│
|
|
586
|
-
├── tokens/
|
|
587
|
-
│ ├──
|
|
588
|
-
│
|
|
589
|
-
│
|
|
590
|
-
│
|
|
591
|
-
│
|
|
434
|
+
├── tokens/ # Generated (gitignored)
|
|
435
|
+
│ ├── shared/ # Primitives (4 files)
|
|
436
|
+
│ └── brands/ # Brand-specific (3 brands)
|
|
437
|
+
│ ├── bild/
|
|
438
|
+
│ ├── sportbild/
|
|
439
|
+
│ └── advertorial/
|
|
592
440
|
│
|
|
593
|
-
├── dist/
|
|
594
|
-
│ ├── css/
|
|
595
|
-
│ ├──
|
|
596
|
-
│
|
|
597
|
-
│ └── json/
|
|
441
|
+
├── dist/ # Generated (gitignored)
|
|
442
|
+
│ ├── css/, scss/, js/, json/ # Web platforms
|
|
443
|
+
│ ├── ios/, android/, flutter/ # Native platforms
|
|
444
|
+
│ └── manifest.json # Build metadata
|
|
598
445
|
│
|
|
599
446
|
└── README.md
|
|
600
447
|
```
|
|
601
448
|
|
|
449
|
+
### Custom Figma Plugin Export
|
|
450
|
+
|
|
451
|
+
The pipeline expects a JSON export from a custom Figma plugin with the following structure:
|
|
452
|
+
|
|
453
|
+
```json
|
|
454
|
+
{
|
|
455
|
+
"variableCollections": [
|
|
456
|
+
{
|
|
457
|
+
"id": "VariableCollectionId:...",
|
|
458
|
+
"name": "CollectionName",
|
|
459
|
+
"modes": [
|
|
460
|
+
{ "modeId": "mode-id", "name": "mode-name" }
|
|
461
|
+
],
|
|
462
|
+
"variableIds": ["VariableID:..."]
|
|
463
|
+
}
|
|
464
|
+
],
|
|
465
|
+
"variables": [
|
|
466
|
+
{
|
|
467
|
+
"id": "VariableID:...",
|
|
468
|
+
"name": "token/path/name",
|
|
469
|
+
"resolvedType": "COLOR|FLOAT|STRING",
|
|
470
|
+
"valuesByMode": {
|
|
471
|
+
"mode-id": "#DD0000" // Direct value
|
|
472
|
+
// OR
|
|
473
|
+
"mode-id": { "type": "VARIABLE_ALIAS", "id": "VariableID:..." }
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
]
|
|
477
|
+
}
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
**Export Location**: `src/design-tokens/bild-design-system-raw-data.json`
|
|
481
|
+
|
|
602
482
|
### Development Workflow
|
|
603
483
|
|
|
604
484
|
1. **Export from Figma**
|
|
605
|
-
- Use
|
|
606
|
-
- Export as `
|
|
485
|
+
- Use custom Figma plugin
|
|
486
|
+
- Export as `bild-design-system-raw-data.json`
|
|
607
487
|
|
|
608
488
|
2. **Place JSON**
|
|
609
489
|
- Save to `src/design-tokens/`
|
|
@@ -612,30 +492,99 @@ gh workflow run build-tokens.yml
|
|
|
612
492
|
```bash
|
|
613
493
|
npm run preprocess
|
|
614
494
|
```
|
|
615
|
-
- Resolves aliases
|
|
616
|
-
- Creates intermediate token files
|
|
617
|
-
-
|
|
495
|
+
- Resolves all aliases to final values
|
|
496
|
+
- Creates intermediate token files in `tokens/`
|
|
497
|
+
- Output: 68 JSON files (4 shared + 64 brand-specific)
|
|
618
498
|
|
|
619
499
|
4. **Build**
|
|
620
500
|
```bash
|
|
621
501
|
npm run build:tokens
|
|
622
502
|
```
|
|
623
|
-
- Transforms to all
|
|
624
|
-
- **
|
|
503
|
+
- Transforms to all 7 platforms
|
|
504
|
+
- **52/52 builds successful**
|
|
505
|
+
- ⚠️ Warnings about token collisions (LetterSpacing) are expected but non-critical
|
|
625
506
|
|
|
626
507
|
5. **Verify**
|
|
627
508
|
```bash
|
|
628
509
|
# Check brand-specific values
|
|
629
|
-
grep "
|
|
510
|
+
grep "bild-red" dist/css/brands/bild/semantic/color/colormode-light.css
|
|
511
|
+
grep "bild-red" dist/css/brands/sportbild/semantic/color/colormode-light.css
|
|
630
512
|
|
|
631
|
-
#
|
|
632
|
-
|
|
633
|
-
#
|
|
513
|
+
# Check Advertorial has no color folder
|
|
514
|
+
ls dist/css/brands/advertorial/semantic/
|
|
515
|
+
# Expected: breakpoints/, effects/, typography/ (NO color/)
|
|
516
|
+
|
|
517
|
+
# Check all platforms exist
|
|
518
|
+
ls dist/
|
|
519
|
+
# Expected: css/, scss/, js/, json/, ios/, android/, flutter/, manifest.json
|
|
634
520
|
```
|
|
635
521
|
|
|
636
522
|
---
|
|
637
523
|
|
|
638
|
-
##
|
|
524
|
+
## 🔄 CI/CD Integration
|
|
525
|
+
|
|
526
|
+
### GitHub Actions Workflows
|
|
527
|
+
|
|
528
|
+
#### 1. Build Tokens (`.github/workflows/build-tokens.yml`)
|
|
529
|
+
|
|
530
|
+
**Triggers:**
|
|
531
|
+
- Push to `main`, `develop`, `claude/**`, `figma-tokens` branches
|
|
532
|
+
- Changes in `src/design-tokens/`, `scripts/`, `build-config/`
|
|
533
|
+
- Manual workflow dispatch
|
|
534
|
+
|
|
535
|
+
**Steps:**
|
|
536
|
+
1. Checkout repository
|
|
537
|
+
2. Setup Node.js 20
|
|
538
|
+
3. Install dependencies
|
|
539
|
+
4. Run `npm run build`
|
|
540
|
+
5. Commit dist/ folder to feature branches
|
|
541
|
+
6. Upload build artifacts (30 days retention)
|
|
542
|
+
|
|
543
|
+
**Outputs:**
|
|
544
|
+
- Validates build success: 52/52 builds
|
|
545
|
+
- Commits dist/ to branch (for PR workflows)
|
|
546
|
+
- Creates artifacts: `design-tokens-{sha}.zip`
|
|
547
|
+
|
|
548
|
+
#### 2. Auto PR from Figma (`.github/workflows/auto-pr-from-figma.yml`)
|
|
549
|
+
|
|
550
|
+
**Trigger:**
|
|
551
|
+
- Push to `figma-tokens` branch (from Figma plugin)
|
|
552
|
+
|
|
553
|
+
**Workflow:**
|
|
554
|
+
```
|
|
555
|
+
Figma Plugin Push → figma-tokens branch
|
|
556
|
+
↓
|
|
557
|
+
Build Tokens (52/52)
|
|
558
|
+
↓
|
|
559
|
+
Commit dist/ to branch
|
|
560
|
+
↓
|
|
561
|
+
Create/Update Pull Request
|
|
562
|
+
↓
|
|
563
|
+
Merge to main
|
|
564
|
+
↓
|
|
565
|
+
Publish to NPM (automatic)
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
**PR Format:**
|
|
569
|
+
- Title: "chore: update design tokens from Figma"
|
|
570
|
+
- Body: Build statistics, changed files, diff summary
|
|
571
|
+
- Auto-assigns reviewers
|
|
572
|
+
|
|
573
|
+
### Manual Workflow Dispatch
|
|
574
|
+
|
|
575
|
+
**Via GitHub UI:**
|
|
576
|
+
1. Go to **Actions** tab
|
|
577
|
+
2. Select **"Build Design Tokens"**
|
|
578
|
+
3. Click **"Run workflow"**
|
|
579
|
+
|
|
580
|
+
**Via GitHub CLI:**
|
|
581
|
+
```bash
|
|
582
|
+
gh workflow run build-tokens.yml
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
---
|
|
586
|
+
|
|
587
|
+
## 🧪 Testing & Verification
|
|
639
588
|
|
|
640
589
|
### Build Verification
|
|
641
590
|
|
|
@@ -643,124 +592,231 @@ gh workflow run build-tokens.yml
|
|
|
643
592
|
# Run full build
|
|
644
593
|
npm run build
|
|
645
594
|
|
|
646
|
-
#
|
|
647
|
-
#
|
|
595
|
+
# Expected output:
|
|
596
|
+
# 📦 Baue Shared Primitives:
|
|
597
|
+
# ✅ fontprimitive
|
|
598
|
+
# ✅ colorprimitive
|
|
599
|
+
# ✅ sizeprimitive
|
|
600
|
+
# ✅ spaceprimitive
|
|
601
|
+
#
|
|
602
|
+
# 🏷️ Baue Brand-spezifische Tokens:
|
|
603
|
+
# 📦 bild: ✅ density (3 modes) ✅ breakpoints (4 modes) ✅ color (2 modes) ✅ overrides (2 collections)
|
|
604
|
+
# 📦 sportbild: ✅ density (3 modes) ✅ breakpoints (4 modes) ✅ color (2 modes) ✅ overrides (2 collections)
|
|
605
|
+
# 📦 advertorial: ✅ density (3 modes) ✅ breakpoints (4 modes) ✅ overrides (1 collection)
|
|
606
|
+
#
|
|
607
|
+
# ✍️ Baue Typography Tokens:
|
|
608
|
+
# 🏷️ bild: ✅ bild-xs (css, scss, js, json, flutter) ✅ bild-sm (+ ios, android) ...
|
|
609
|
+
#
|
|
610
|
+
# 🎨 Baue Effect Tokens:
|
|
611
|
+
# 🏷️ Brand: bild ✅ bild-light (css, scss, js, json, ios, android, flutter) ...
|
|
612
|
+
#
|
|
613
|
+
# 📊 Statistiken:
|
|
614
|
+
# - Shared Primitives: 4/4
|
|
615
|
+
# - Brand-spezifische Tokens: 30/30
|
|
616
|
+
# - Typography Builds: 12/12
|
|
617
|
+
# - Effect Builds: 6/6
|
|
618
|
+
# - Builds erfolgreich: 52/52
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
### Brand-Specific Values
|
|
622
|
+
|
|
623
|
+
```bash
|
|
624
|
+
# BILD should use Gotham Condensed
|
|
625
|
+
grep "font-family-gotham-cond" dist/css/brands/bild/semantic/typography/typography-md.css
|
|
626
|
+
|
|
627
|
+
# SportBILD should use AntennaExtraCond
|
|
628
|
+
grep "font-family-antenna-extra-cond" dist/css/brands/sportbild/semantic/typography/typography-md.css
|
|
648
629
|
|
|
649
|
-
#
|
|
650
|
-
|
|
630
|
+
# BILD red: #DD0000
|
|
631
|
+
grep "bild-red-bild-red" dist/css/shared/colorprimitive.css
|
|
632
|
+
# Expected: --bild-red-bild-red: #DD0000;
|
|
633
|
+
|
|
634
|
+
# SportBILD has different brand colors
|
|
635
|
+
grep "sport-bild-dark-blue" dist/css/shared/colorprimitive.css
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
### Advertorial Special Case
|
|
639
|
+
|
|
640
|
+
```bash
|
|
641
|
+
# Advertorial should NOT have color/ folder
|
|
642
|
+
ls dist/css/brands/advertorial/semantic/
|
|
643
|
+
# Expected: breakpoints/ effects/ typography/ (NO color/)
|
|
651
644
|
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
cat dist/css/semantic/sportbild/color/color-sportbild-light.css | grep "core-color-primary"
|
|
645
|
+
ls dist/css/brands/bild/semantic/
|
|
646
|
+
# Expected: breakpoints/ color/ effects/ typography/
|
|
655
647
|
```
|
|
656
648
|
|
|
657
|
-
###
|
|
649
|
+
### Breakpoint Scaling
|
|
658
650
|
|
|
659
651
|
```bash
|
|
660
|
-
#
|
|
661
|
-
|
|
652
|
+
# Typography scales across breakpoints
|
|
653
|
+
# headline1 should scale from 48px (xs) to 100px (lg) for BILD
|
|
662
654
|
|
|
663
|
-
|
|
655
|
+
grep "headline1" dist/json/brands/bild/semantic/typography/typography-xs.json | grep fontSize
|
|
656
|
+
# Expected: 48px
|
|
657
|
+
|
|
658
|
+
grep "headline1" dist/json/brands/bild/semantic/typography/typography-lg.json | grep fontSize
|
|
659
|
+
# Expected: 100px
|
|
664
660
|
```
|
|
665
661
|
|
|
666
662
|
---
|
|
667
663
|
|
|
668
664
|
## 🆘 Troubleshooting
|
|
669
665
|
|
|
670
|
-
###
|
|
666
|
+
### ⚠️ Variable nicht gefunden: VariableID:16104:163534
|
|
667
|
+
|
|
668
|
+
**Problem:** Preprocessing warns about missing variable
|
|
669
|
+
|
|
670
|
+
**Cause:** Variable `Component/Kicker/Partner/kickerStylebookBgColor` references a deleted/renamed variable in Figma
|
|
671
|
+
|
|
672
|
+
**Impact:** Non-critical - Token gets `UNRESOLVED_` value, build continues
|
|
673
|
+
|
|
674
|
+
**Solution:** In Figma, check and re-link the `kickerStylebookBgColor` variable
|
|
675
|
+
|
|
676
|
+
### ⚠️ Token Collisions in fontprimitive/sizeprimitive/spaceprimitive
|
|
677
|
+
|
|
678
|
+
**Problem:** Style Dictionary warns about token name collisions for some platforms
|
|
671
679
|
|
|
672
|
-
**
|
|
680
|
+
**Cause:** LetterSpacing tokens have positive/negative values with similar names:
|
|
681
|
+
- `letterSpace-0_25` (negative) → `LetterSpace025` (JS/iOS/Flutter)
|
|
682
|
+
- `letterSpace0_25` (positive) → `LetterSpace025` (same!)
|
|
673
683
|
|
|
674
|
-
**
|
|
675
|
-
- Uses `value === undefined || value === null` checks (handles `0`, `false`, `""` correctly)
|
|
676
|
-
- Uses Variable IDs for circular reference detection (not names)
|
|
677
|
-
- Resolves cross-collection aliases correctly per brand
|
|
684
|
+
**Impact:** Non-critical - Last value wins, usually works fine
|
|
678
685
|
|
|
679
|
-
**
|
|
686
|
+
**Platforms Affected:**
|
|
687
|
+
- ❌ JavaScript, iOS, Android, Flutter, JSON (name collision)
|
|
688
|
+
- ✅ CSS, SCSS (no collision - hyphens preserved)
|
|
680
689
|
|
|
681
|
-
|
|
690
|
+
**Solution (Figma-side):**
|
|
691
|
+
Rename tokens in Figma:
|
|
692
|
+
```
|
|
693
|
+
letterSpace-0_25 → letterSpaceNeg0_25 (or letterSpaceMinus0_25)
|
|
694
|
+
letterSpace0_25 → letterSpacePos0_25 (or letterSpacePlus0_25)
|
|
695
|
+
```
|
|
682
696
|
|
|
683
|
-
|
|
697
|
+
### Build Failures
|
|
684
698
|
|
|
685
|
-
**
|
|
686
|
-
- Maps brand names to Mode IDs in brand collections
|
|
687
|
-
- Resolves aliases using the correct brand-specific mode
|
|
688
|
-
- Generates separate token files per brand
|
|
699
|
+
**Problem:** Build fails with "ENOENT: no such file or directory"
|
|
689
700
|
|
|
690
|
-
**
|
|
701
|
+
**Solution:**
|
|
691
702
|
```bash
|
|
692
|
-
#
|
|
693
|
-
|
|
703
|
+
# Make sure preprocessing ran first
|
|
704
|
+
npm run preprocess
|
|
705
|
+
|
|
706
|
+
# Then build
|
|
707
|
+
npm run build:tokens
|
|
708
|
+
|
|
709
|
+
# Or use the combined command
|
|
710
|
+
npm run build
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
**Problem:** "Cannot find module 'style-dictionary'"
|
|
694
714
|
|
|
695
|
-
|
|
696
|
-
|
|
715
|
+
**Solution:**
|
|
716
|
+
```bash
|
|
717
|
+
npm install
|
|
697
718
|
```
|
|
698
719
|
|
|
699
|
-
###
|
|
720
|
+
### Missing dist/ Folder
|
|
700
721
|
|
|
701
|
-
**Problem:**
|
|
722
|
+
**Problem:** dist/ folder not visible after build
|
|
723
|
+
|
|
724
|
+
**Solution:** dist/ is gitignored. It's generated locally or in CI/CD:
|
|
725
|
+
```bash
|
|
726
|
+
npm run build
|
|
727
|
+
ls dist/ # Should show css/, scss/, js/, json/, ios/, android/, flutter/
|
|
728
|
+
```
|
|
702
729
|
|
|
703
|
-
|
|
704
|
-
- Fully gitignored
|
|
705
|
-
- Generated locally or in CI/CD
|
|
706
|
-
- Never committed to the repository
|
|
730
|
+
### Wrong Platform Outputs
|
|
707
731
|
|
|
708
|
-
|
|
732
|
+
**Problem:** Some platforms missing files
|
|
709
733
|
|
|
710
|
-
**
|
|
734
|
+
**Solution:** Check build output for errors:
|
|
735
|
+
```bash
|
|
736
|
+
npm run build 2>&1 | grep "❌"
|
|
737
|
+
```
|
|
711
738
|
|
|
712
|
-
|
|
713
|
-
- **Stable Collection IDs** instead of names
|
|
714
|
-
- IDs never change even if you rename collections
|
|
715
|
-
- Names are kept only for logging purposes
|
|
739
|
+
All platforms should build successfully: 52/52
|
|
716
740
|
|
|
717
741
|
---
|
|
718
742
|
|
|
719
|
-
## 📊
|
|
743
|
+
## 📊 Technical Details
|
|
720
744
|
|
|
721
|
-
|
|
722
|
-
- ✅ 30/30 builds successful
|
|
723
|
-
- ✅ 0 warnings
|
|
724
|
-
- ✅ 0 errors
|
|
725
|
-
- ✅ ~3s preprocessing
|
|
726
|
-
- ✅ ~5s build
|
|
727
|
-
- ✅ 178 token files generated
|
|
728
|
-
- ✅ All cross-collection aliases resolved
|
|
729
|
-
- ✅ Brand-specific values verified
|
|
745
|
+
### Key Design Decisions
|
|
730
746
|
|
|
731
|
-
|
|
747
|
+
1. **Complete Alias Resolution in Preprocessing**
|
|
748
|
+
- No `{Alias.Path}` syntax in Style Dictionary
|
|
749
|
+
- All aliases resolved to final Hex/px/numeric values
|
|
750
|
+
- Prevents reference errors in Style Dictionary
|
|
732
751
|
|
|
733
|
-
|
|
752
|
+
2. **Context-Aware Alias Resolution**
|
|
753
|
+
- Brand × Breakpoint × ColorMode matrix
|
|
754
|
+
- Each context combination gets unique resolution
|
|
755
|
+
- Example: `colormode-light` for BILD resolves brand-specific aliases using BILD's mode ID
|
|
734
756
|
|
|
735
|
-
|
|
736
|
-
-
|
|
737
|
-
-
|
|
738
|
-
-
|
|
757
|
+
3. **Mode Name Matching**
|
|
758
|
+
- Collections have different mode IDs
|
|
759
|
+
- Match by `mode.name` instead of `mode.modeId`
|
|
760
|
+
- Robust against Figma re-creating modes
|
|
761
|
+
|
|
762
|
+
4. **Brand-Specific Processing**
|
|
763
|
+
- Separate token files per brand and mode
|
|
764
|
+
- Prevents collisions during Style Dictionary build
|
|
765
|
+
- Enables brand-specific value verification
|
|
766
|
+
|
|
767
|
+
5. **Size Class Terminology**
|
|
768
|
+
- iOS/Android use "sizeclass" terminology
|
|
769
|
+
- Only compact (sm) and regular (lg) generated
|
|
770
|
+
- xs and md breakpoints skipped for native platforms
|
|
771
|
+
|
|
772
|
+
### Performance
|
|
773
|
+
|
|
774
|
+
- **Preprocessing**: ~2-3 seconds
|
|
775
|
+
- **Build**: ~8-10 seconds (all 52 builds)
|
|
776
|
+
- **Total**: ~11 seconds
|
|
777
|
+
- **Output Size**: ~15 MB (all platforms)
|
|
739
778
|
|
|
740
779
|
---
|
|
741
780
|
|
|
742
781
|
## 📝 Changelog
|
|
743
782
|
|
|
744
|
-
###
|
|
783
|
+
### v2.0.0 (Current) - Custom Plugin Migration
|
|
745
784
|
|
|
746
785
|
**✨ Features:**
|
|
747
|
-
-
|
|
748
|
-
-
|
|
749
|
-
-
|
|
750
|
-
-
|
|
751
|
-
-
|
|
786
|
+
- Custom Figma Plugin integration (replaces Variable Visualizer)
|
|
787
|
+
- 7 platform support: CSS, SCSS, JS, JSON, iOS, Android, Flutter
|
|
788
|
+
- Complete alias resolution in preprocessing (no Style Dictionary references)
|
|
789
|
+
- Composite token support: Typography (12 builds), Effects (6 builds)
|
|
790
|
+
- Brand-specific output structure: `dist/{platform}/brands/{brand}/`
|
|
791
|
+
- Advertorial special handling (no color/ folder)
|
|
792
|
+
- Size class mapping for iOS/Android (compact/regular only)
|
|
793
|
+
- Context-aware alias resolution: Brand × Breakpoint × ColorMode
|
|
752
794
|
|
|
753
795
|
**🐛 Bug Fixes:**
|
|
754
|
-
-
|
|
755
|
-
-
|
|
756
|
-
-
|
|
757
|
-
-
|
|
796
|
+
- FontWeight bug fix: "700px" → 700
|
|
797
|
+
- Mode name matching instead of ID-based (robust against Figma changes)
|
|
798
|
+
- YAML syntax fix in GitHub Actions (multi-line commit messages)
|
|
799
|
+
- Exit code 0 for successful builds
|
|
800
|
+
- dist/ folder commits to feature branches
|
|
758
801
|
|
|
759
802
|
**⚡ Performance:**
|
|
760
|
-
-
|
|
761
|
-
-
|
|
762
|
-
-
|
|
763
|
-
|
|
803
|
+
- 52/52 builds successful (up from 30/30)
|
|
804
|
+
- All 7 platforms generate complete token sets
|
|
805
|
+
- ~11 seconds total build time
|
|
806
|
+
|
|
807
|
+
**📦 Migration:**
|
|
808
|
+
- New scripts: `preprocess-plugin-tokens.js`, `build-tokens-v2.js`
|
|
809
|
+
- New token source: `bild-design-system-raw-data.json`
|
|
810
|
+
- Removed: Old Variable Visualizer scripts and token files
|
|
811
|
+
|
|
812
|
+
---
|
|
813
|
+
|
|
814
|
+
## 🔗 Resources
|
|
815
|
+
|
|
816
|
+
- [Style Dictionary v4 Documentation](https://styledictionary.com/)
|
|
817
|
+
- [Figma Variables API](https://www.figma.com/plugin-docs/api/properties/figma-variables/)
|
|
818
|
+
- [Design Tokens Community Group](https://design-tokens.github.io/community-group/)
|
|
819
|
+
- [Repository Issues](https://github.com/UXWizard25/vv-token-test-v3/issues)
|
|
764
820
|
|
|
765
821
|
---
|
|
766
822
|
|