hymhub / css-to-tailwind

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

use default values #2

Closed TobiasLueger closed 1 year ago

TobiasLueger commented 1 year ago

Could you convert the default values like 0.5rem/8px to 2 for padding for example.

So if you put in: padding: 0.5rem;

it converts to: p-2

Same for the margin attribute. Like you did for the width attributes.

hymhub commented 1 year ago

Thanks for the suggestion, I will consider adding the preset writing method in the future https://github.com/hymhub/css-to-tailwind/issues/1#issuecomment-1521836453

TobiasLueger commented 1 year ago

@hymhub Thanks, it would be useful in many projects.

hymhub commented 1 year ago

Hey, the new version provides the useAllDefaultValues option, which can basically convert all default values https://github.com/hymhub/css-to-tailwind#configuration image

jamesscottbrown commented 1 year ago

This is a useful feature, but I suggest enabling this setting by default.

I initially treid to use the tool and was confused why the output included classes like border-[2px]. It took me a while to realise that I needed to check the useAllDefaultValues box for conversions to work correctly.

hymhub commented 1 year ago

This is a useful feature, but I suggest enabling this setting by default.

I initially treid to use the tool and was confused why the output included classes like border-[2px]. It took me a while to realise that I needed to check the useAllDefaultValues box for conversions to work correctly.

Now, useAllDefaultValues defaults to true, and users who have modified the configuration before will not be affected, localStorage will remember the configuration image

jorgezreik commented 1 year ago

Should we close this issue now that the requested changes have been implemented?

johann-taberlet commented 1 year ago

I think it doesn't works for font-size. font-size: 3rem => text-[3rem] instead of text-5xl