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

Add support for React (JSX) #4

Closed praveenperera closed 4 years ago

praveenperera commented 4 years ago

Is your feature request related to a problem? Please describe. This won't work inside JSX files

Describe the solution you'd like We could edit the regex to include jsx className=.... https://github.com/heybourn/headwind/blob/master/src/extension.ts#L8

Alternatives Check how vscode-tailwindcss works and use a similar approach of only running on certain file types? Maybe make it possible to work with other languages like Elm?

heybourn commented 4 years ago

This should be relatively easy to implement. Do you have any other examples of the class tag varying between languages/frameworks?

praveenperera commented 4 years ago

The one that comes to mind is Elm:

https://package.elm-lang.org/packages/elm/html/latest/Html-Attributes#class

But I can make the change for it to work with JSX for now.

Dobby89 commented 4 years ago

Would this fix work with .tsx files in typescript?

heybourn commented 4 years ago

If it's a simple regex change then it should work globally (so long as the extension can find a class value of some kind)

SaschaDens commented 4 years ago

Would it be a possibility to have this regex available as a setting? This way it remains flexible, regardless of the syntax.

If it's an option I would like to give it a shot to create a PR.

heybourn commented 4 years ago

Go for gold!