Skip to content

Commit 77e7a85

Browse files
authored
refactor: changed tailwind tokens to work with dbux-3 (#164)
* refactor: changed tailwind tokens to work with dbux-3
1 parent 064323a commit 77e7a85

File tree

4 files changed

+39
-39
lines changed

4 files changed

+39
-39
lines changed

scripts/tailwind-config-generator.mjs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,11 @@ const run = async () => {
2020
theme: {
2121
screens: tokens.screens,
2222
spacing: tokens.spacing,
23-
fontFamily: tokens.font.family,
24-
fontSize: tokens.fontSize,
25-
colors: tokens.colors,
2623
gap: ({ theme }) => ({
27-
...theme('spacing'),
28-
...tokens.gap
24+
...theme('spacing')
2925
}),
3026
space: ({ theme }) => ({
31-
...theme('spacing'),
32-
...tokens.space
27+
...theme('spacing')
3328
})
3429
}
3530
};

style-dictionary.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,24 @@ const generateClasses = require('./scripts/scss-typography-generator');
1111
const generateScaling = require('./scripts/scss-scaling-generator');
1212

1313
const modifyTailwind = (dictionary) => {
14-
const colors = JSON.stringify(dictionary.colors).replace(
15-
/enabled/g,
16-
'DEFAULT'
17-
);
18-
dictionary.colors = JSON.parse(colors);
19-
delete dictionary.typography;
14+
for (const token of [
15+
'colors',
16+
'elevation',
17+
'font',
18+
'transition',
19+
'sizing',
20+
'typography'
21+
]) {
22+
if (dictionary[token]) {
23+
delete dictionary[token];
24+
}
25+
}
26+
27+
for (const spacing of ['responsive', 'fixed']) {
28+
if (dictionary.spacing?.[spacing]) {
29+
delete dictionary.spacing[spacing];
30+
}
31+
}
2032
};
2133

2234
StyleDictionary.registerFormat({

tokens/tailwind/font-size.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

tokens/tailwind/spacing.json

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
{
2-
"gap": {
3-
"xs": "8px",
4-
"sm": "12px",
5-
"md": "12px",
6-
"lg": "20px",
7-
"xl": "20px"
8-
},
9-
"space": {
10-
"xs": "8px",
11-
"sm": "12px",
12-
"md": "12px",
13-
"lg": "20px",
14-
"xl": "20px"
2+
"spacing": {
3+
"fix-3xs": "var(--db-spacing-fixed-3xs)",
4+
"fix-2xs": "var(--db-spacing-fixed-2xs)",
5+
"fix-xs": "var(--db-spacing-fixed-xs)",
6+
"fix-sm": "var(--db-spacing-fixed-sm)",
7+
"fix-md": "var(--db-spacing-fixed-md)",
8+
"fix-lg": "var(--db-spacing-fixed-lg)",
9+
"fix-xl": "var(--db-spacing-fixed-xl)",
10+
11+
"res-xs": "var(--db-spacing-responsive-xs)",
12+
"res-sm": "var(--db-spacing-responsive-sm)",
13+
"res-md": "var(--db-spacing-responsive-md)",
14+
"res-lg": "var(--db-spacing-responsive-lg)",
15+
"res-xl": "var(--db-spacing-responsive-xl)",
16+
17+
"siz-xs": "var(--db-sizing-xs)",
18+
"siz-sm": "var(--db-sizing-sm)",
19+
"siz-md": "var(--db-sizing-md)",
20+
"siz-lg": "var(---db-sizing-lg)"
1521
}
1622
}

0 commit comments

Comments
 (0)