tailwindest
tailwindest copied to clipboard
[feature-request] Generate types from tailwind.config.js
Is your feature request related to a problem? Please describe. Is it possible to generate the typescript types from the tailwind.config.js file instead of manually creating them?
Describe the solution you'd like To be able to generate the types with a command rather than defining them manually.
There might a be a good reason why you already know this isn't possible, but if it just hasn't been explored yet then I'm happy to have a go at implementing it.
Creating types for tailwind
via tailwind.config.js
is a great idea. Here are some of the pros and cons.
Pros
- natural and stable type creation via
tailwind.config.js
- removes the generic option for
Tailwindest
types, increasing usability
Cons
- Requires type creation via CLI scripts for each user individually.
- Lack of official documentation link function (
@see
) and function description (@description
) through jsdoc
Let me introduce two representative repos that implement the above ideas. tailwind-ts, typewind
If you want to add type generation via CLI to tailwindest
, analyzing the CLI script of typewind
would be a good starting point. However, there is a concern about whether tailwind
's class type can be extracted as a styled key-value format when extracting as an object.
This could be quite a challenge, but it would provide a better user experience if we could refactor in this way.
Thank you so much for your ideas. I didn't think of that approach when I first started making tailwindest
, so I made it with pure typescript
. I think it would be a nice feature if it didn't require any major changes to the API and, most importantly, didn't break any existing styles.
Thanks for the detailed response! I'll take a look at those links and see if there is anything I can do.
This package is really good and I appreciate all of your work on it! I'm migrating from https://github.com/muhammadsammy/tailwindcss-classnames because I've had issues with the types (sometimes :dark
prefix or the opacity modifier for colors doesn't work) and the api is annoying to work with.
This has been a great developer experience so far, however it was quite a big barrier to have to manually define the custom types for my tailwind.config.js
changes. Especially as I have about 100 color variants 😠It was almost enough to put me off using the package so I thought it would be great if we could help reduce the work required for that step!
I'm really glad to hear that you had a good development experience with tailwindest
. And I'll also think about how to generate types with CLI. Lastly, I haven't written a contribution guide yet, I will make it soon, Thanks! 😃
I'm redesign current Tailwindest
customization generic option structure at V2.2.0 to setup tailwind.config.js
values by new setup CLI package! So, now we don't have to generate types from tailwind
package:) (In my opinion)
Let me know what you think!
I stumbled upon this project the other day, it looks promising and I'm going to try updating a few projects to use it. I was wondering about this feature too, perhaps it would be possible/easier to implement this functionality by doing the inverse – generate the tailwind config from the tailwindest template args? Just a thought. Obviously, the most clear-cut way to achieve this is by reading the file existing projects will already have.