Skip to content

Commit 32dc0ca

Browse files
committed
WIP
1 parent f266a2a commit 32dc0ca

File tree

2 files changed

+102
-5
lines changed

2 files changed

+102
-5
lines changed

src/layouts/ContentsLayout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export function ContentsLayout({ children, meta, classes, tableOfContents, secti
231231
description={meta.description}
232232
repo={meta.repo}
233233
badge={{ key: 'Tailwind CSS version', value: meta.featureVersion }}
234-
section={section}
234+
section={section ?? meta.section}
235235
/>
236236
<ContentsContext.Provider value={{ registerHeading, unregisterHeading }}>
237237
{classes ? (

src/pages/docs/v4-beta.mdx

Lines changed: 101 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,123 @@
11
---
2-
title: Tailwind CSS v4.0-beta
3-
description: Using responsive utility variants to build adaptive user interfaces.
2+
section: Prerelease Documentation
3+
title: Tailwind CSS v4.0 Beta
4+
description: Preview what's coming in the next version of Tailwind CSS.
45
---
56

67
import { Heading } from '@/components/Heading'
78
import { TipGood, TipBad } from '@/components/Tip'
89

10+
{/*
911
- Introduction, has a graphic or code sample
1012
- Link to blog post
1113
- Summarize improvements
1214
- Talk about upgrade + link to upgrade section
1315
- Mention breaking changes, link to those
16+
*/}
1417

1518
## Getting started
1619

1720
### Installing with Vite
1821

22+
If you're using Vite or a Vite-powered framework like SvelteKit or Remix, install Tailwind along with our new dedicated Vite plugin:
23+
24+
```bash {{ filename: 'Terminal' }}
25+
$ npm install tailwindcss@next @tailwindcss/vite@next
26+
```
27+
28+
Next, add our Vite plugin to your `vite.config.ts` file:
29+
30+
```ts {{ filename: 'vite.config.ts' }}
31+
import { defineConfig } from 'vite';
32+
> import tailwindcss from '@tailwindcss/vite';
33+
34+
export default defineConfig({
35+
plugins: [
36+
> tailwindcss()
37+
],
38+
});
39+
```
40+
41+
Finally, import Tailwind into your main CSS file:
42+
43+
```css {{ filename: 'src/index.css' }}
44+
> @import "tailwindcss";
45+
```
46+
1947
### Installing with PostCSS
2048

49+
If your project uses PostCSS or you're using a framework like Next.js that supports PostCSS plugins, install Tailwind along with our new dedicated PostCSS plugin:
50+
51+
```bash {{ filename: 'Terminal' }}
52+
$ npm install tailwindcss@next @tailwindcss/postcss@next
53+
```
54+
55+
Next, add our PostCSS plugin to your `postcss.config.js` file:
56+
57+
```ts {{ filename: 'postcss.config.mjs' }}
58+
export default {
59+
plugins: {
60+
> '@tailwindcss/postcss': {},
61+
},
62+
};
63+
```
64+
65+
Finally, import Tailwind into your main CSS file:
66+
67+
```css {{ filename: 'app.css' }}
68+
> @import "tailwindcss";
69+
```
70+
2171
### Installing the CLI
2272

73+
If you want to use our dedicated CLI tool, install Tailwind along with our new dedicated CLI package:
74+
75+
```bash {{ filename: 'Terminal' }}
76+
$ npm install tailwindcss@next @tailwindcss/cli@next
77+
```
78+
79+
Next, import Tailwind into your main CSS file:
80+
81+
```css {{ filename: 'app.css' }}
82+
> @import "tailwindcss";
83+
```
84+
85+
Then compile your CSS using the CLI tool:
86+
```bash {{ filename: 'Terminal' }}
87+
$ npx @tailwindcss/cli -i input.css -o output.css
88+
```
89+
90+
You can also download [standalone builds](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.0-beta-1) of the new CLI tool from GitHub for projects that don't otherwise depend on the Node.js ecosystem.
91+
2392
### Upgrading from v3
2493

94+
If you'd like to try upgrading a project from v3 to the v4 beta releases, you can use our upgrade tool to do the vast majority of the heavy lifting for you:
95+
96+
```bash {{ filename: 'Terminal' }}
97+
$ npx @tailwindcss/upgrade@next
98+
```
99+
100+
For most projects, the upgrade tool will automate the entire migration process including:
101+
102+
- **Updating dependencies** like Tailwind itself, adding the new PostCSS plugin, updating our Prettier plugin if you have it installed, and removing dependencies that are no longer needed like `postcss-import` and `autoprefixer`.
103+
- **Replacing `@tailwind` directives with `@import "tailwindcss"`** to modernize your project.
104+
- **Migrating your config file to CSS** if possible, or updating your CSS to import your config file with `@config`.
105+
- **Replacing deprecated utility classes** with their v4 equivalents, like renaming `outline-none` to `outline-hidden`.
106+
- **Updating your variant order** so that order-sensitive variants in your utilities are sorted from left to right instead of right to left.
107+
- **Replacing `theme(…)` with `var(…)`** where possible, taking advantage of the CSS variables generated in v4.0 by default.
108+
- **Migrating to the new variable shorthand syntax**, updating utilities like `bg-[--my-color]` to `bg-(--my-color)`.
109+
- **Adding compatibility base styles for Preflight changes**, so your project looks the same after upgrading.
110+
- **Updating custom utilities to use `@utility`** instead of just custom classes in the `utilities` layer.
111+
- **Updating existing imports to use layers** to make sure your custom styles behave as expected with Tailwind's layered styles.
112+
113+
**We recommend running the upgrade tool in a new branch**, then carefully reviewing the diff and testing your project in the browser to make sure all of the changes look correct. You may need to tweak a few things by hand in complex projects, but the tool will save you a ton of time either way.
114+
115+
It's also a good idea to go over all of the [breaking changes](#breaking-changes) in v4.0 and get a good understanding of what's changed, in case there are other things you need to update in your project that the upgrade tool doesn't catch.
116+
117+
25118
---
26119

27-
## What's new in v4
120+
## What's new in v4.0
28121

29122
### CSS-first configuration
30123

@@ -154,4 +247,8 @@ import { TipGood, TipBad } from '@/components/Tip'
154247

155248
### Hover styles ignored on mobile
156249

157-
### Core plugins cannot be disabled
250+
### Core plugins cannot be disabled
251+
252+
### Using a JavaScript config file
253+
254+
- Not autodetected, need to use `@config`

0 commit comments

Comments
 (0)