Skip to content

Commit

Permalink
fix(preset-mini): remove num === 0 in px handler to fix offset utilit…
Browse files Browse the repository at this point in the history
…y issues (#3271)
  • Loading branch information
henrikvilhelmberglund committed Nov 2, 2023
1 parent 9e891ab commit 0890f59
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions packages/preset-mini/src/_utils/handlers/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,8 @@ export function px(str: string) {
return
const [, n, unit] = match
const num = Number.parseFloat(n)
if (!Number.isNaN(num)) {
if (num === 0)
return '0'
if (!Number.isNaN(num))
return unit ? `${round(num)}${unit}` : `${round(num)}px`
}
}

export function number(str: string) {
Expand Down
2 changes: 1 addition & 1 deletion test/assets/output/preset-mini-targets.css
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ unocss .scope-\[unocss\]\:block{display:block;}
.border-x{border-left-width:1px;border-right-width:1px;}
.border-b{border-bottom-width:1px;}
.border-e-4{border-inline-end-width:4px;}
.border-s-0{border-inline-start-width:0;}
.border-s-0{border-inline-start-width:0px;}
.border-t-2,
.border-t-size-2{border-top-width:2px;}
.border-inline{border-inline-start-width:1px;border-inline-end-width:1px;}
Expand Down

0 comments on commit 0890f59

Please sign in to comment.