Request/Help classList regex
aquaductape opened this issue · comments
Caleb Taylor commented
For some reason this regex doesn't work on classList property.
{
"tailwindCSS.experimental.classRegex": [
"classList={{([^}]+)}}"
]
}
<button
class="p-2 border border-gray-200 rounded-md"
classList={{ 'p-4': isDark() }}
>
Lesson
</button>
Then I had a thought that you can't intellisense object string keys, but you can using the class comment hack. So it is possible to intellisense object string keys.
```js
<button
class="p-2 border border-gray-200 rounded-md"
// class="
classList={{ 'p-4': isDark() }}
//"
>
Lesson
</button>
But on paper the regex should work as it does here https://regex101.com/r/5I3Fsb/1
Kevin Abatan commented
Hello, I may found a solution, you can try this regex, it works for me :)
{
"tailwindCSS.experimental.classRegex": [
["classList={{([^;]*)}}", "\\s*?[\"'`]([^\"'`]*).*?:"]
]
}
Hope it helps ;)
@paolotiu You may add it to the list of the readme :)
Kevin Abatan commented
@paolotiu Hello, i was wrong with my previous regex, the good one is this one:
{
"tailwindCSS.experimental.classRegex": [
["classList={{([^;]*)}}", "\\s*?[\"'`]([^\"'`]*).:"]
],
}
You can test it here
paolotiu commented
Added it! Thank you so much @carere and @aquaductape <3