Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regex for tagged template literals #33

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ A regex expressions for tailwind intellisense
- [Comment Tagging](#comment-tagging)
- [Laravel Blade directives and component attribute functions](#laravel-blade-directives-and-component-attribute-functions)
- [Stimulus CSS Classes](#stimulus-css-classes)
- [Tagged Template Literals](#tagged-template-literals)
- [Literally everywhere](#everywhere)


Expand Down Expand Up @@ -388,6 +389,23 @@ Credits: [czernika](https://github.com/czernika) and [Nicholas Davidson](https:/
</form>
```

#### Tagged Template Literals

```json
"tailwindCSS.experimental.classRegex": [
[
"(tw`(?:(?:(?:[^`]*\\$\\{[^]*?\\})[^`]*)+|[^`]*`))",
"((?:(?<=`)(?:[^\"'`]*)(?=\\${|`))|(?:(?<=\\})(?:[^\"'`]*)(?=\\${))|(?:(?<=\\})(?:[^\"'`]*)(?=`))|(?:(?<=')(?:[^\"'`]*)(?='))|(?:(?<=\")(?:[^\"'`]*)(?=\"))|(?:(?<=`)(?:[^\"'`]*)(?=`)))"
],
]
```

```js
tw`bg-black ${ok ? 'text-white' : `text-red-500 ${errorClassName}`} ${className}`
```

Credits: [sxxov](https://github.com/sxxov)

## EVERYWHERE!!!
For those who are just looking for a quick fix and want to enable tailwind intellisense everywhere.

Expand Down