You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are using VS Code as your editor – you can try our new *[Twind Intellisense for VS Code](https://github.com/tw-in-js/vscode-twind-intellisense)* extension:
15
+
If you are using VS Code as your editor – you can try our new _[Twind Intellisense for VS Code](https://github.com/tw-in-js/vscode-twind-intellisense)_ extension:
19
16
20
17
[Install via the Visual Studio Code Marketplace →](https://marketplace.visualstudio.com/items?itemName=sastan.twind-intellisense)
21
18
22
19
---
20
+
21
+
</div>
22
+
23
23
<!-- prettier-ignore-start -->
24
24
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
25
25
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
@@ -37,14 +37,20 @@ If you are using VS Code as your editor – you can try our new *[Twind Intellis
37
37
38
38
## Features
39
39
40
-
Provides editor support for `tw` tagged template syntax including:
41
-
42
-
- Autocomplete for [twind](https://github.com/tw-in-js/twind) variants and classes
43
-
- Details about the generated CSS
40
+
- IntelliSense for [twind](https://github.com/tw-in-js/twind) variants and classes within
41
+
-`tw` and `apply`
42
+
- JSX attributes (`tw`, `class`, and `className`)
43
+
-[style](https://twind.dev/docs/modules/twind_style.html) and `styled` (like [@twind/react](https://github.com/tw-in-js/twind-react/#readme) or [@twind/solid](https://github.com/tw-in-js/use-twind-with/tree/main/packages/solid#readme))
44
+
- Quick Info about
45
+
- generated CSS
46
+
- used theme value
47
+
- the `px` value for `rem` values
48
+
- Color preview
44
49
- Support for grouping of variants and classes
45
-
- Warnings on unknown classes
46
-
- Warnings on unknown theme values
47
-
- Warnings on unknown variants
50
+
- Warnings on
51
+
- unknown classes
52
+
- unknown theme values
53
+
- unknown variants
48
54
49
55
## Installation
50
56
@@ -83,11 +89,7 @@ declare module 'twind' {
83
89
84
90
> If no `twind.config.{ts,js,cjs,mjs}` exists and a `tailwind.config.{ts,js,cjs,mjs}` is found, the compatible values from the tailwind config will be used.
85
91
86
-
### With VS Code
87
-
88
-
Currently you must manually install the plugin along side TypeScript in your workspace.
89
-
90
-
Then add a `plugins` section to your [`tsconfig.json`](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) or [`jsconfig.json`](https://code.visualstudio.com/Docs/languages/javascript#_javascript-project-jsconfigjson)
92
+
Add a `plugins` section to your [`tsconfig.json`](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) or [`jsconfig.json`](https://code.visualstudio.com/Docs/languages/javascript#_javascript-project-jsconfigjson)
91
93
92
94
```json
93
95
{
@@ -101,6 +103,12 @@ Then add a `plugins` section to your [`tsconfig.json`](http://www.typescriptlang
101
103
}
102
104
```
103
105
106
+
See [Configuration](#configuration) below for details options.
107
+
108
+
### With VS Code
109
+
110
+
Currently you must manually install the plugin along side TypeScript in your workspace.
111
+
104
112
Finally, run the `Select TypeScript version` command in VS Code to switch to use the workspace version of TypeScript for VS Code's JavaScript and TypeScript language support. You can find more information about managing typescript versions [in the VS Code documentation](https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-the-workspace-version-of-typescript).
105
113
106
114
By default VS Code will not trigger completions when editing "string" content, for example within JSX attribute values. Updating the `editor.quickSuggestions` setting may improve your experience, particularly when editing Tailwind classes within JSX:
@@ -126,94 +134,162 @@ And configure Sublime to use the workspace version of TypeScript by [setting the
126
134
}
127
135
```
128
136
129
-
Finally add a `plugins` section to your [`tsconfig.json`](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) or [`jsconfig.json`](https://code.visualstudio.com/Docs/languages/javascript#_javascript-project-jsconfigjson) and restart Sublime.
137
+
### With Atom
138
+
139
+
This plugin works with the [Atom TypeScript plugin](https://atom.io/packages/atom-typescript).
140
+
141
+
To get sytnax highlighting for styled strings in Atom, consider installing the [language-babel](https://atom.io/packages/language-babel) extension.
142
+
143
+
### With Visual Studio
144
+
145
+
This plugin works [Visual Studio 2017](https://www.visualstudio.com) using the TypeScript 2.5+ SDK.
146
+
147
+
Then reload your project to make sure the plugin has been loaded properly. Note that `jsconfig.json` projects are currently not supported in VS.
148
+
149
+
## Configuration
150
+
151
+
### Tags
152
+
153
+
This plugin adds IntelliSense to any template literal [tagged](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) with `tw` or `apply`:
154
+
155
+
```js
156
+
import { tw } from'twind'
157
+
158
+
tw`
159
+
sm:hover:(
160
+
bg-black
161
+
text-white
162
+
)
163
+
md:(bg-white hover:text-black)
164
+
`
165
+
```
166
+
167
+
You can enable IntelliSense for other tag names by configuring `"tags"`:
130
168
131
169
```json
132
170
{
133
171
"compilerOptions": {
134
172
"plugins": [
135
173
{
136
-
"name": "@twind/typescript-plugin"
174
+
"name": "@twind/typescript-plugin",
175
+
"tags": ["tw", "cx"]
137
176
}
138
177
]
139
178
}
140
179
}
141
180
```
142
181
143
-
### With Atom
182
+
Now strings tagged with either `tw` and `cx` will have IntelliSense.
144
183
145
-
This plugin works with the [Atom TypeScript plugin](https://atom.io/packages/atom-typescript).
184
+
### Attributes
146
185
147
-
Then add a `plugins` section to your [`tsconfig.json`](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) or [`jsconfig.json`](https://code.visualstudio.com/Docs/languages/javascript#_javascript-project-jsconfigjson) and restart Atom.
186
+
This plugin adds IntelliSense to JSX `tw`, `class`, and `className` attributes:
187
+
188
+
```js
189
+
<span
190
+
className="text-purple-400"
191
+
tw={`
192
+
sm:hover:(
193
+
bg-black
194
+
text-white
195
+
)
196
+
md:(bg-white hover:text-black)
197
+
`}
198
+
>...</span>
199
+
`
200
+
```
201
+
202
+
You can enable IntelliSense for other attributes by configuring `"attributes"`:
148
203
149
204
```json
150
205
{
151
206
"compilerOptions": {
152
207
"plugins": [
153
208
{
154
-
"name": "@twind/typescript-plugin"
209
+
"name": "@twind/typescript-plugin",
210
+
"attributes": ["tw"]
155
211
}
156
212
]
157
213
}
158
214
}
159
215
```
160
216
161
-
To get sytnax highlighting for styled strings in Atom, consider installing the [language-babel](https://atom.io/packages/language-babel) extension.
217
+
Now only the `tw` attribute will have IntelliSense.
162
218
163
-
### With Visual Studio
219
+
### Styles
164
220
165
-
This plugin works [Visual Studio 2017](https://www.visualstudio.com) using the TypeScript 2.5+ SDK.
221
+
This plugin adds IntelliSense to [style](https://twind.dev/docs/modules/twind_style.html) and `styled` (like [@twind/react](https://github.com/tw-in-js/twind-react/#readme) or [@twind/solid](https://github.com/tw-in-js/use-twind-with/tree/main/packages/solid#readme))
222
+
223
+
```js
224
+
// Same for style({... })
225
+
const Button = styled("button", {
226
+
base: `
227
+
appearance-none border-none bg-transparent
228
+
rounded-full px-2.5
229
+
`,
230
+
231
+
variants: {
232
+
variant: {
233
+
gray: `
234
+
bg-gray-500
235
+
hover:bg-gray-600
236
+
`,
237
+
primary: `
238
+
text-white bg-purple-500
239
+
hover:bg-purple-600
240
+
`,
241
+
},
242
+
243
+
outlined: {
244
+
true: `bg-transparent ring-1`,
245
+
},
246
+
},
247
+
248
+
matches: [
249
+
{
250
+
variant: "gray",
251
+
outlined: true,
252
+
use: `ring-gray-500`,
253
+
},
254
+
}
255
+
})
256
+
```
166
257
167
-
Then add a `plugins` section to your [`tsconfig.json`](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html).
258
+
You can enable IntelliSense for other `style` like functions by configuring `"styles"`:
168
259
169
260
```json
170
261
{
171
262
"compilerOptions": {
172
263
"plugins": [
173
264
{
174
-
"name": "@twind/typescript-plugin"
265
+
"name": "@twind/typescript-plugin",
266
+
"styles": ["styled", "stitched"]
175
267
}
176
268
]
177
269
}
178
270
}
179
271
```
180
272
181
-
Then reload your project to make sure the plugin has been loaded properly. Note that `jsconfig.json` projects are currently not supported in VS.
273
+
Now the `styled` and `stitched` functions will have IntelliSense.
182
274
183
-
##Configuration
275
+
### Debug
184
276
185
-
### Tags
186
-
187
-
This plugin adds IntelliSense to any template literal [tagged](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) with `tw`, `ow` or `bw`:
188
-
189
-
```js
190
-
import { bw } from'beamwind'
191
-
192
-
bw`
193
-
sm:hover:(
194
-
bg-black
195
-
text-white
196
-
)
197
-
md:(bg-white hover:text-black)
198
-
`
199
-
```
200
-
201
-
You can enable IntelliSense for other tag names by configuring `"tags"`:
277
+
Allows to enabling/disabling additional debug information shown in hover and completion popups (default:`false`).
202
278
203
279
```json
204
280
{
205
281
"compilerOptions": {
206
282
"plugins": [
207
283
{
208
284
"name": "@twind/typescript-plugin",
209
-
"tags": ["tw", "cx"]
285
+
"debug": true
210
286
}
211
287
]
212
288
}
213
289
}
214
290
```
215
291
216
-
Now strings tagged with either `tw` and `cx` will have IntelliSense.
0 commit comments