File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010
1111For a steady stream of TILs, [ sign up for my newsletter] ( https://tinyletter.com/jbranchaud ) .
1212
13- _ 1031 TILs and counting..._
13+ _ 1032 TILs and counting..._
1414
1515---
1616
@@ -901,6 +901,7 @@ _1031 TILs and counting..._
901901### Tailwind CSS
902902
903903- [ Base Styles For Text Link] ( tailwind/base-styles-for-text-link.md )
904+ - [ Specify Paths For Purging Unused CSS] ( tailwind/specify-paths-for-purging-unused-css.md )
904905
905906### tmux
906907
Original file line number Diff line number Diff line change 1+ # Specify Paths For Purging Unused CSS
2+
3+ Tailwind CSS is a full-featured utility class CSS framework. It has just about
4+ everything you need. It also has a bunch of things you probably don't need. And
5+ there is no need to ship the CSS you don't need to the client. Tailwind is able
6+ to exclude the unused CSS through a mechanism called _ purging_ .
7+
8+ To turn on purging (for _ production_ ) and for Tailwind to know what can be
9+ safely purged, you need to specify one or more _ purge paths_ in your
10+ ` tailwind.config.js ` file. This is a listing of all the places where you use
11+ Tailwind utility classes.
12+
13+ Specify it with an array at the ` purge ` key:
14+
15+ ``` javascript
16+ module .exports = {
17+ purge: [
18+ " ./src/components/**/*.jsx" ,
19+ " ./pages/**/*.js"
20+ ],
21+ darkMode: false ,
22+ theme: {
23+ extend: {},
24+ },
25+ variants: {
26+ extend: {},
27+ },
28+ plugins: [],
29+ };
30+ ```
31+
32+ Notice that globbed paths can be used as a way of specifying files located in a
33+ nested directory structure. Above I've stated that any ` jsx ` files located
34+ anywhere under ` src/components/ ` as well as any ` js ` files located anywhere
35+ under ` pages/ ` should be checked.
36+
37+ [ source] ( https://tailwindcss.com/docs/optimizing-for-production#basic-usage )
You can’t perform that action at this time.
0 commit comments