tailwind-ctp-intellisense/README.md

96 lines
4.2 KiB
Markdown
Raw Normal View History

2020-06-22 19:53:13 +00:00
<img src="https://raw.githubusercontent.com/bradlc/vscode-tailwindcss/diagnostics/.github/banner.png" alt="" />
2020-06-11 14:25:15 +00:00
2020-06-22 16:55:09 +00:00
## Installation
2020-06-11 14:25:15 +00:00
2020-06-23 15:42:04 +00:00
**[Install via the Visual Studio Code Marketplace →](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss)**
2020-06-22 19:58:37 +00:00
2020-06-22 16:55:09 +00:00
In order for the extension to activate you must have [`tailwindcss` installed](https://tailwindcss.com/docs/installation/#1-install-tailwind-via-npm) and a [Tailwind config file](https://tailwindcss.com/docs/installation/#3-create-your-tailwind-config-file-optional) named `tailwind.config.js` or `tailwind.js` in your workspace.
2020-06-11 14:25:15 +00:00
## Features
2020-06-23 11:21:42 +00:00
### Autocomplete
2020-06-11 14:25:15 +00:00
2020-06-23 11:21:42 +00:00
Intelligent suggestions for class names, as well as [CSS functions and directives](https://tailwindcss.com/docs/functions-and-directives/).
2020-06-22 19:51:16 +00:00
2020-06-23 11:21:42 +00:00
<img src="https://raw.githubusercontent.com/bradlc/vscode-tailwindcss/diagnostics/.github/autocomplete.png" alt="" />
2020-06-11 14:25:15 +00:00
2020-06-23 11:21:42 +00:00
### Linting
2020-06-22 19:51:16 +00:00
2020-06-23 11:21:42 +00:00
Highlights errors and potential bugs in both your CSS and your markup.
2020-06-23 09:51:57 +00:00
2020-06-23 11:21:42 +00:00
<img src="https://raw.githubusercontent.com/bradlc/vscode-tailwindcss/diagnostics/.github/linting.png" alt="" />
2020-06-11 14:25:15 +00:00
2020-06-23 11:21:42 +00:00
### Hover Preview
See the complete CSS for a Tailwind class name by hovering over it.
<img src="https://raw.githubusercontent.com/bradlc/vscode-tailwindcss/diagnostics/.github/hover.png" alt="" />
### CSS Syntax Highlighting
Provides syntax definitions so that Tailwind features are highlighted correctly.
2020-06-11 15:00:51 +00:00
## Settings
### `tailwindCSS.includeLanguages`
This setting allows you to add additional language support. The key of each entry is the new language ID and the value is any one of the extensions built-in languages, depending on how you want the new language to be treated (e.g. `html`, `css`, or `javascript`):
```json
{
"tailwindCSS.includeLanguages": {
"plaintext": "html"
}
}
```
2020-06-22 16:55:09 +00:00
### `tailwindCSS.emmetCompletions`
2020-06-11 15:00:51 +00:00
2020-06-11 15:02:15 +00:00
Enable completions when using [Emmet](https://emmet.io/)-style syntax, for example `div.bg-red-500.uppercase`. **Default: `false`**
2020-06-11 15:00:51 +00:00
```json
{
"tailwindCSS.emmetCompletions": true
}
```
2020-06-22 16:55:09 +00:00
### `tailwindCSS.validate`
Enable linting. Rules can be configured individually using the `tailwindcss.lint` settings:
- `ignore`: disable lint rule entirely
- `warning`: rule violations will be considered "warnings," typically represented by a yellow underline
- `error`: rule violations will be considered "errors," typically represented by a red underline
2020-06-22 20:11:54 +00:00
2020-06-22 20:13:06 +00:00
#### `tailwindCSS.lint.invalidScreen`
2020-06-22 20:11:54 +00:00
Unknown screen name used with the [`@screen` directive](https://tailwindcss.com/docs/functions-and-directives/#screen). **Default: `error`**
2020-06-22 20:13:06 +00:00
#### `tailwindCSS.lint.invalidVariant`
2020-06-22 20:11:54 +00:00
Unknown variant name used with the [`@variants` directive](https://tailwindcss.com/docs/functions-and-directives/#variants). **Default: `error`**
2020-06-22 20:13:06 +00:00
#### `tailwindCSS.lint.invalidTailwindDirective`
2020-06-22 20:11:54 +00:00
Unknown value used with the [`@tailwind` directive](https://tailwindcss.com/docs/functions-and-directives/#tailwind). **Default: `error`**
2020-06-22 20:13:06 +00:00
#### `tailwindCSS.lint.invalidApply`
2020-06-22 20:11:54 +00:00
2020-06-23 09:25:56 +00:00
Unsupported use of the [`@apply` directive](https://tailwindcss.com/docs/functions-and-directives/#apply). **Default: `error`**
2020-06-22 20:11:54 +00:00
2020-06-22 20:13:06 +00:00
#### `tailwindCSS.lint.invalidConfigPath`
2020-06-22 20:11:54 +00:00
Unknown or invalid path used with the [`theme` helper](https://tailwindcss.com/docs/functions-and-directives/#theme). **Default: `error`**
2020-06-23 11:42:21 +00:00
#### `tailwindCSS.lint.cssConflict`
2020-06-22 20:11:54 +00:00
Class names on the same HTML element which apply the same CSS property or properties. **Default: `warning`**
2020-06-23 13:43:27 +00:00
## Troubleshooting
If youre having issues getting the IntelliSense features to activate, there are a few things you can check:
- Ensure that you have a Tailwind config file in your workspace and that this is named `tailwind.config.js` or `tailwind.js`. Check out the Tailwind documentation for details on [creating a config file](https://tailwindcss.com/docs/installation/#3-create-your-tailwind-config-file-optional).
- Ensure that the `tailwindcss` module is installed in your workspace, via `npm`, `yarn`, or `pnpm`. Tailwind CSS IntelliSense does not currently support Yarn Plug'n'Play.
- If you installed `tailwindcss` or created your config file while your project was already open in Visual Studio Code you may need to reload the editor. You can either restart VS Code entirely, or use the `Developer: Reload Window` command which can be found in the command palette.