Hexi

Hexi

Record my life

TailwindCSS Practical Tips Collection

Tailwind CSS IntelliSens#

Tailwind CSS IntelliSens is a VSCode plugin used for syntax suggestions and auto-completion. It is an essential plugin.

https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss

Here are some common issues listed below:

1. A space is needed to trigger auto-completion#

The following configuration in .vscode/settings.json can solve this issue:

"editor.quickSuggestions": {
  "strings": true
},

2. Customizing the trigger timing for auto-completion#

By default, the plugin triggers auto-completion when the user writes className=xxx, but sometimes we encapsulate common classNames, for example, into a js object. This can be resolved in settings.json by configuring tailwindCSS.experimental.classRegex:

"tailwindCSS.experimental.classRegex": [
  ["cn\\(([^)]*)\\)", "[\"'`]([^\"'`]*)[\"'`]"]
]

For more custom rules, please refer to: https://github.com/paolotiu/tailwind-intellisense-regex-list#classnames

The effect is as follows:

image

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.