heybourn / headwind

An opinionated Tailwind CSS class sorter built for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=heybourn.headwind
MIT License
1.38k stars 46 forks source link

[WIP] Add all classes #53

Closed praveenperera closed 4 years ago

praveenperera commented 4 years ago

Created a default sorter file with all > 16,000 classes created generated by the default Tailwind CSS config.

With this PR classes will be sorted by how they appear in tailwind. One advantage of this is that that all responsive classes sm:.., xl:... should also now be sorted properly

To Do

Future

After this PR, we can look into watching the users tailwind.config.js and rebuilding the sorter array from it when it changes.

@heybourn, @joshmanders what do you think?

This would address #52

heybourn commented 4 years ago

Woah! Interesting approach. How necessary is it to have our own file full of classes? Is it not possible to tap into these directly through a Tailwind install?

praveenperera commented 4 years ago

It might be possible to use Tailwind to get just a list of class names, I'm not sure I haven't looked into that.

However, the problem with that is, it be it would be pretty slow. Tailwind would have to to spit out the list of class names every time headwind was to run. I guess we could save the list of class names to a file the first time, but then we are back to what I have right now.

Also since the list of class names would only change when the tailwind.config.js file changes this would be a lot of wasted effort.

What I want to do in the future is:

  1. Use tailwind to dynamically generate the class names
  2. Save the class names to a file
  3. Watch tailwind.config.js for changes, and regenerate and save the class names to the file ONLY when it changes
buffalom commented 4 years ago

@praveenperera what's the status of this PR? Any updates?

praveenperera commented 4 years ago

@Buffalom I think this approach only makes sense if the order of the classes tailwindcss generates is the same order we want headwind to sort by. I don't think right now it makes sense to order by the order of appearance in tailwind.css. I will close this.