Skip to content

Commit 7e5bdf7

Browse files
Add docs
1 parent daacc5e commit 7e5bdf7

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

packages/@tailwindcss-vite/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,43 @@
2121

2222
---
2323

24+
# `@tailwindcss/vite`
25+
2426
## Documentation
2527

2628
For full documentation, visit [tailwindcss.com](https://tailwindcss.com).
2729

30+
---
31+
32+
## Advanced topics
33+
34+
### API reference
35+
36+
The Vite plugin can be configured by passing an object to the `tailwindcss()`. Here is a full list of available options:
37+
38+
| Property | Values |
39+
| --------------------------------------------- | ----------------------------------------- |
40+
| [`scanner`](#disabling-module-graph-scanning) | `module-graph` _(default)_, `file-system` |
41+
42+
### Disabling module-graph scanning
43+
44+
Our Vite plugin is designed to take the Vite module graph into account when scanning for utilities used in your project. This will work well in most cases since the module graph contains all markup that will be in your final build.
45+
46+
However, sometimes your Vite setup is split across different build steps (e.g. when using SSR builds). If that is the case, you might find that the client build might contain more utilities since it traverses all components while the server build doesn't.
47+
48+
To ensure that both builds read all components from your project, set the `scanner` option to `file-system`:
49+
50+
```js
51+
import { defineConfig } from 'vite'
52+
import tailwindcss from '@tailwindcss/vite'
53+
54+
export default defineConfig({
55+
plugins: [tailwindcss({ scanner: 'file-system' })],
56+
})
57+
```
58+
59+
---
60+
2861
## Community
2962

3063
For help, discussion about best practices, or any other conversation that would benefit from being searchable:

0 commit comments

Comments
 (0)