Skip to content

Commit 0c08759

Browse files
authored
Merge pull request #24 from mertasan/numeric-values
Fixed: numeric values are rendered incorrectly.
2 parents 4c9c0e1 + 2a4e164 commit 0c08759

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

__tests__/issues.test.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ test('issue 23', async () => {
1414
'body-bg': '#fff',
1515
'body-font-family': 'var(--font-primary)',
1616
'body-font-size': '1rem',
17-
'body-font-weight': '400',
18-
'body-line-height': '1.5',
17+
'body-font-weight': 400,
18+
'body-line-height': 1.5,
19+
'body-font-weight2': '400',
20+
'body-line-height2': '1.5',
1921
},
2022
},
2123
},
@@ -32,7 +34,9 @@ test('issue 23', async () => {
3234
+ --body-font-family: var(--font-primary);
3335
+ --body-font-size: 1rem;
3436
+ --body-font-weight: 400;
35-
+ --body-line-height: 1.5
37+
+ --body-line-height: 1.5;
38+
+ --body-font-weight2: 400;
39+
+ --body-line-height2: 1.5
3640
+ }
3741
3842
"

src/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const parseVariables = (object, varPrefix) => {
7676
if (hasOwn(object, key) && isPlainObject(object[key])) {
7777
newObject = recurse(object[key], formattedKey ? pre + formattedKey : pre.slice(0, -1))
7878
} else {
79-
newObject[formattedKey ? pre + formattedKey : pre.slice(0, -1)] = object[key]
79+
newObject[formattedKey ? pre + formattedKey : pre.slice(0, -1)] = `${object[key]}`
8080
}
8181
}
8282
return newObject

0 commit comments

Comments
 (0)