hymhub / css-to-tailwind

Convert CSS code to Tailwindcss syntax in real time
https://hymhub.github.io/css-to-tailwind/
MIT License
362 stars 22 forks source link

`height` not using default values #6

Closed jorgezreik closed 1 year ago

jorgezreik commented 1 year ago

Love this repo, incredible job with it! I think it has a ton of potential.

If you're accepting community contributions, I could open a PR to fix this myself. Lmk what you think!

Issue

height doesn't use default values in the same way width does.

Reproduction

Taken from the online demo

Input:

* {
    width: 2rem;
    height: 2rem;
}

Output:

w-8
h-[2rem]

Possible Cause

The height configuration has no reference to default values:

val => (isUnit(val) ? `h-${getUnitMetacharactersVal(val, [CustomSelect.vw]) || `[${val}]`}` : '')

On the other hand, the width configuration does:

val => (isUnit(val) ? `w-${(useAllDefaultValues && getRemDefaultVal(val)) || getUnitMetacharactersVal(val, [CustomSelect.vh]) || `[${val}]`}` : '')

Thus, I believe we can fix this issue by using the useAllDefaultValues function in the height configuration as well.

hymhub commented 1 year ago

You are right, it is now fixed, and subsequently if you find new problems, you can create PR directly if you wish, thank you for providing the problem