DEV Community

Dan
Dan

Posted on

Make Tailwind Intelisense Work Everywhere in Vscode

If you're using the Tailwind CSS IntelliSense vscode extension you might have noticed that this

const tailwindClasses = "text-15 p-6"
Enter fullscreen mode Exit fullscreen mode

will not show any tooltips.

The easiest method without using something like Class Variance Authority if you don't need state machines is to

const tw = String.raw

const tailwindClasses = tw`text-15 p-6`
Enter fullscreen mode Exit fullscreen mode

and add to settings.json

"tailwindCSS.experimental.classRegex": [
    "tw`([^`]*)"
  ]
Enter fullscreen mode Exit fullscreen mode

Very similar in how people use gql

Top comments (0)