laytan / tailwind-sorter.nvim

Easily sort Tailwind classes in Neovim.
MIT License
142 stars 12 forks source link

Laravel Blade / PHP Support #73

Closed bagwaa closed 1 year ago

bagwaa commented 1 year ago

I've been looking into making this work for .php files (it seems to be displayed in the readme file as an option, but I can't see any config for it), but also for Laravel .blade.php files. In theory they should be ; inherits: html as they are just template languages in the same structure as twig.

I've tried adding a php folder inside queries with a tailwind.scm file with the above content but it doesn't seem to pick this up.

Any pointers in the right direction would be appreciated.

Thanks for the great work on this.

laytan commented 1 year ago

I will have a look on this tomorrow, it should be pretty easy and I think I had blade working at some point.

JuanVqz commented 1 year ago

hey Laytan, taking advantage of this issue is open, Do you think you could include support for haml? Thank you, anyways 👍

laytan commented 1 year ago

So after looking at this for a while, PHP should be supported by default, and I confirmed it worked for me. This is because the treesitter grammar for PHP uses injections for the HTML part, thus the HTML queries are automatically available there.

For blade, and also for haml, there is no treesitter parser, so I can't easily support it. In blade you could do :set ft=php and it would work, but that would remove any highlighting you might have for blade.