Skip to content

Commit 51ae8f7

Browse files
Copilotdermatz
andcommitted
Add comprehensive documentation for Hyva tokens in advanced usage guide
Co-authored-by: dermatz <6103201+dermatz@users.noreply.github.com>
1 parent ded1e9c commit 51ae8f7

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

docs/advanced_usage.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,86 @@ MageForge streamlines Hyvä theme development with:
4747
- Automatic TailwindCSS compilation
4848
- PurgeCSS optimization
4949
- Component scanning
50+
- Design tokens support for consistent theming
51+
52+
#### Hyvä Design Tokens
53+
54+
The `mageforge:hyva:tokens` command allows you to generate CSS custom properties from design token definitions, making it easier to maintain consistent design systems across your Hyvä theme.
55+
56+
**Basic Usage:**
57+
```bash
58+
bin/magento mageforge:hyva:tokens <theme-code>
59+
```
60+
61+
**Configuration Options:**
62+
63+
Create a `hyva.config.json` file in your theme's `web/tailwind` directory to customize token generation:
64+
65+
1. **Using a token file (default format):**
66+
```json
67+
{
68+
"tokens": {
69+
"src": "design.tokens.json"
70+
}
71+
}
72+
```
73+
74+
Then create `design.tokens.json`:
75+
```json
76+
{
77+
"colors": {
78+
"primary": {
79+
"lighter": "oklch(62.3% 0.214 259.815)",
80+
"DEFAULT": "oklch(54.6% 0.245 262.881)",
81+
"darker": "oklch(37.9% 0.146 265.522)"
82+
}
83+
},
84+
"spacing": {
85+
"small": "8px",
86+
"medium": "16px",
87+
"large": "24px"
88+
}
89+
}
90+
```
91+
92+
2. **Using Figma tokens:**
93+
```json
94+
{
95+
"tokens": {
96+
"src": "acme.figma-tokens.json",
97+
"format": "figma"
98+
}
99+
}
100+
```
101+
102+
3. **Using inline token values:**
103+
```json
104+
{
105+
"tokens": {
106+
"values": {
107+
"colors": {
108+
"primary": {
109+
"lighter": "oklch(62.3% 0.214 259.815)",
110+
"DEFAULT": "oklch(54.6% 0.245 262.881)",
111+
"darker": "oklch(37.9% 0.146 265.522)"
112+
}
113+
}
114+
}
115+
}
116+
}
117+
```
118+
119+
4. **Using custom CSS selector (for Tailwind v3):**
120+
```json
121+
{
122+
"tokens": {
123+
"src": "design.tokens.json",
124+
"cssSelector": ":root"
125+
}
126+
}
127+
```
128+
129+
The command generates `generated/hyva-tokens.css` with CSS custom properties that you can import in your Tailwind configuration.
50130

51131
### Custom Tailwind CSS Implementations
52132

0 commit comments

Comments
 (0)