Skip to content

Commit 7be36d8

Browse files
docs: add page for tailwindcss
1 parent bb23643 commit 7be36d8

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

docs/canary/plugins/tailwindcss.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
description: "Use Tailwindcss to style your app"
3+
---
4+
5+
[Tailwindcss](https://tailwindcss.com/) is a utility-first CSS framework that
6+
generates CSS out of the class names that are used in JSX. Since we use
7+
Tailwindcss ourselves here at Deno, Fresh ships with an official plugin for
8+
that.
9+
10+
## Usage
11+
12+
1. Set `nodeModulesDir` in `deno.json` to `"auto"` or `"manual"`
13+
14+
```diff deno.json
15+
{
16+
"name": "@example/my-cool-project"
17+
+ "nodeModulesDir": "auto",
18+
"imports": {
19+
...
20+
}
21+
}
22+
```
23+
24+
2. Run `deno install jsr:@fresh/plugin-tailwind`
25+
3. Update `dev.ts`:
26+
27+
```diff dev.ts
28+
import { Builder } from "fresh/dev";
29+
import { app } from "./main.ts";
30+
+ import { tailwind } from "@fresh/plugin-tailwind";
31+
32+
const builder = new Builder();
33+
+ tailwind(builder, app);
34+
```
35+
36+
4. Add `@import "tailwindcss";` at the top of your main stylesheet.
37+
38+
For more information on how to use tailwindcss, check out
39+
[their documentation](https://tailwindcss.com/docs/styling-with-utility-classes).
40+
41+
## Options
42+
43+
You can customize the tailwind plugin via the following options:
44+
45+
```ts
46+
tailwind(builder, app, {
47+
// Exclude certain files from processing
48+
exclude: ["/admin/**", "*.temp.css"],
49+
// Force optimization (defaults to production mode)
50+
optimize: true,
51+
// Exclude base styles
52+
base: null,
53+
});
54+
```

docs/toc.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ const toc: RawTableOfContents = {
7272
pages: [
7373
["cors", "cors", "link:canary"],
7474
["trailing-slashes", "trailingSlashes", "link:canary"],
75+
["tailwindcss", "tailwindcss", "link:canary"],
7576
],
7677
},
7778
examples: {

0 commit comments

Comments
 (0)