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
exportconst title ="Detecting classes in source files";
7
8
exportconst description ="Understanding and customizing how Tailwind scans your source files.";
@@ -199,6 +200,7 @@ This can be useful in projects that have multiple Tailwind stylesheets where you
199
200
200
201
If you need to make sure Tailwind generates certain class names that don’t exist in your content files, you can force them to be inlined by using `@source inline()`:
201
202
203
+
<CodeExampleStack>
202
204
```css
203
205
/* [!code filename:CSS] */
204
206
@import"tailwindcss";
@@ -213,10 +215,13 @@ If you need to make sure Tailwind generates certain class names that don’t exi
213
215
}
214
216
```
215
217
218
+
</CodeExampleStack>
219
+
216
220
### Generating variants
217
221
218
222
You can also use `@source inline()` to generate classes with variants. For example, to generate the `underline` class with hover and focus variants, add `{hover:,focus:,}` to the source input:
219
223
224
+
<CodeExampleStack>
220
225
```css
221
226
/* [!code filename:CSS] */
222
227
@import"tailwindcss";
@@ -241,19 +246,20 @@ You can also use `@source inline()` to generate classes with variants. For examp
241
246
}
242
247
```
243
248
249
+
</CodeExampleStack>
250
+
244
251
### Generating ranges
245
252
246
253
The source input is [brace expanded](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), so you can generate multiple classes at once. For example, to generate all the red shades with hover variants, you can add a range to the source input:
This will generate shades of red from 50 to 950 in increments of 100, along with hover variants for each shade:
256
-
257
263
```css
258
264
/* [!code filename:Generated CSS] */
259
265
.bg-red-50 {
@@ -290,6 +296,10 @@ This will generate shades of red from 50 to 950 in increments of 100, along with
290
296
}
291
297
```
292
298
299
+
</CodeExampleStack>
300
+
301
+
This generates shades of red from 100 to 900 in increments of 100, along with the first and last shades of 50 and 950. It also adds the `hover:` variant for each of those classes.
302
+
293
303
### Explicitly excluding classes
294
304
295
305
If you need to avoid specific classes from being generated you can use `@source not inline()`:
0 commit comments