Skip to content

Commit

Permalink
Adjust handling of zero values to preserve CSS clamp() compatibility (#…
Browse files Browse the repository at this point in the history
…106)

This change addresses an issue where CSS clamp() functions were breaking because they require a unit to clamp properly. Removing this conditional ensures that the unit is included even when the value is zero, allowing clamp() functions to work correctly with zero values.
  • Loading branch information
michaeldietiker authored Feb 19, 2024
1 parent 6cf23c4 commit a90b209
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function createPxReplace(rootValue, unitPrecision, minPixelValue) {
const pixels = parseFloat($1);
if (pixels < minPixelValue) return m;
const fixedVal = toFixed(pixels / rootValue, unitPrecision);
return fixedVal === 0 ? "0" : fixedVal + "rem";
return fixedVal + "rem";
};
}

Expand Down

0 comments on commit a90b209

Please sign in to comment.