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
To use these styles alongside the rest of Tailwind via CDN, we recommend pulling in each layer separately so you can put the styles in the correct order:
@@ -127,6 +135,49 @@ None of the sizes are automatically responsive, but responsive variants are prov
127
135
</article>
128
136
```
129
137
138
+
## Purging unused styles
139
+
140
+
Since the typography styles are added to the `components` layer and Tailwind only purges `utilities` by default, you will notice that even with the `purge` option configured in your `tailwind.config.js` file, all of the typography styles still remain in your final CSS.
141
+
142
+
If you'd like to purge unused typography styles, you'll need to use the `mode: 'all'` option in your `purge` configuration:
143
+
144
+
```js
145
+
// tailwind.config.js
146
+
module.exports= {
147
+
purge: {
148
+
mode:'all',
149
+
content: [
150
+
// Paths to your templates here...
151
+
],
152
+
},
153
+
}
154
+
```
155
+
156
+
It's important to note that if you are using markdown for any of your source files (perhaps you're working on a blog or similar), that you need to be careful not to accidentally purge styles you actually need.
157
+
158
+
Markdown files for example contain no actual `h2`, `blockquote`, `strong`, etc. elements, so PurgeCSS will remove those styles because it doesn't think you need them.
159
+
160
+
You have two options for solving this:
161
+
162
+
1. Safelist all of the plain HTML elements you need in your config file:
163
+
164
+
```js
165
+
// tailwind.config.js
166
+
module.exports= {
167
+
purge: {
168
+
mode:'all',
169
+
content: [
170
+
// Paths to your templates here...
171
+
],
172
+
options: {
173
+
whitelist: ['h1', 'h2', 'h3', 'p', 'blockquote', 'strong'/* etc. */],
174
+
},
175
+
},
176
+
}
177
+
```
178
+
179
+
2. Use a custom extractor to compile your markdown files _before_ scanning them for tokens. This is more complicated but it is [what we do for the Tailwind blog](https://github.com/tailwindlabs/blog.tailwindcss.com/blob/eb2a0ff80c8e56a79f6514c8dc4253ef84ac5548/tailwind.config.js#L13) for example.
180
+
130
181
## Customization
131
182
132
183
> The customization API is currently extremely low-level in order to be as flexible as possible. We will be introducing higher-level configuration options over time as we learn what types of customizations are most common.
0 commit comments