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
Copy file name to clipboardExpand all lines: src/pages/docs/content-configuration.mdx
+36Lines changed: 36 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -383,6 +383,42 @@ module.exports = {
383
383
}
384
384
```
385
385
386
+
### Discarding classes
387
+
388
+
Since Tailwind uses a very simple approach to detecting class names in your content, you may find that some classes are being generated that you don't actually need.
389
+
390
+
For example, this HTML would still generate the `container` class, even though that class is not actually being used:
391
+
392
+
```html
393
+
<divclass="text-lg leading-8 text-gray-600">
394
+
Every custom pool we design starts as a used shipping **container**, and is
395
+
retrofitted with state of the art technology and finishes to turn it into
396
+
a beautiful and functional way to entertain your guests all summer long.
397
+
</div>
398
+
```
399
+
400
+
You may also want to prevent Tailwind from generating certain classes when those classes would conflict with some existing CSS, but you don't want to go so far as to prefix all of your Tailwind classes.
401
+
402
+
In these situations, you can use the `blocklist` option to tell Tailwind to ignore specific classes that it detects in your content:
403
+
404
+
```js tailwind.config.js
405
+
module.exports= {
406
+
content: [
407
+
'./pages/**/*.{html,js}',
408
+
'./components/**/*.{html,js}',
409
+
],
410
+
blocklist: [
411
+
'container',
412
+
'collapse',
413
+
],
414
+
// ...
415
+
}
416
+
```
417
+
418
+
The `blocklist` option only affects CSS that would be generated by Tailwind, not custom CSS you've authored yourself or are importing from another library.
419
+
420
+
Unlike `safelist`, the `blocklist` option only supports strings, and you cannot block classes using regular expressions.
0 commit comments