Skip to content

Commit 5810233

Browse files
Fix: Avoid precision loss with fractional pixel font-sizes (#178)
Co-authored-by: Jeff <[email protected]>
1 parent e803b6f commit 5810233

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/fluffy-goats-design.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tailwindcss-capsize": patch
3+
---
4+
5+
Fix precision loss with fractional pixel font-sizes

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function normalizeValue(
2222
): number {
2323
value = Array.isArray(value) ? value[0] : value
2424

25-
if (value.endsWith('px')) return parseInt(value.replace('px', ''))
25+
if (value.endsWith('px')) return parseFloat(value.replace('px', ''))
2626
if (value.endsWith('rem'))
2727
return root * parseFloat(value.replace('rem', ''))
2828

0 commit comments

Comments
 (0)