-
Notifications
You must be signed in to change notification settings - Fork 354
Update Tailwind Docs to Tailwind v4 #1065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
4361635
renamed tailwind.mdx to tailwind-v3.mdx with updated links and instal…
deviate-dv8 2992963
updated tailwind docs to tailwind v4
deviate-dv8 94b1f1d
added tailwind-v3.mdx to data.json
deviate-dv8 d2bd68c
Merge branch 'main' into main
kodiakhq[bot] 05f06d3
updated tailwind v4 docs usage from Vite Plugin to PostCSS plugin
deviate-dv8 2768f1d
Merge branch 'main' into main
kodiakhq[bot] 6b3056a
Merge branch 'main' into main
kodiakhq[bot] 4b487be
Merge branch 'main' into main
kodiakhq[bot] e6c2280
Merge branch 'main' into main
kodiakhq[bot] 8694447
Merge branch 'main' into main
kodiakhq[bot] 940b89a
Merge branch 'main' into main
kodiakhq[bot] 0947d68
Merge branch 'main' into main
kodiakhq[bot] cce928d
Merge branch 'main' into main
kodiakhq[bot] 91403a5
Merge branch 'main' into main
kodiakhq[bot] 2936878
Merge branch 'main' into main
kodiakhq[bot] 3541bb6
Merge branch 'main' into main
kodiakhq[bot] 1ecf58b
Merge branch 'main' into main
kodiakhq[bot] 011a8dc
Merge branch 'main' into main
kodiakhq[bot] 6373542
Merge branch 'main' into main
kodiakhq[bot] 861d06d
Merge branch 'main' into main
kodiakhq[bot] ffca020
Update src/routes/guides/styling-components/data.json removed tailwin…
deviate-dv8 9be9802
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 160cf54
Update src/routes/guides/styling-components/tailwind.mdx changed inst…
deviate-dv8 245ad7e
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 1b40566
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 8e9de13
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 e90aee5
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 5a2dc30
Update src/routes/guides/styling-components/tailwind.mdx updated tail…
deviate-dv8 5671940
Update src/routes/guides/styling-components/tailwind.mdx updated tail…
deviate-dv8 d325279
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 d47169e
Update src/routes/guides/styling-components/tailwind.mdx removed note…
deviate-dv8 7368b2e
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 4177c9c
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 901468d
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 906562f
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 976cd19
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 c2b5fc5
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 707380c
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 2bfe153
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 f3da123
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 a17daf1
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 e28e576
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 21caf9f
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 6f07cc1
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 4f459a8
Update src/routes/guides/styling-components/tailwind.mdx
deviate-dv8 9223996
Update tailwind.mdx
deviate-dv8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| --- | ||
| title: TailwindCSS v3 | ||
| order: 7 | ||
| mainNavExclude: true | ||
| --- | ||
|
|
||
| [Tailwind CSS v3](https://v3.tailwindcss.com/) is an on-demand utility CSS library that integrates seamlessly with Solid as a built-in PostCSS plugin. | ||
|
|
||
| ## Installation | ||
|
|
||
| 1. Install Tailwind CSS as a development dependency: | ||
|
|
||
| <TabsCodeBlocks> | ||
| <div id="npm"> | ||
| ```bash frame="none" | ||
| npm i --save-dev tailwindcss@3 postcss autoprefixer | ||
| ``` | ||
| </div> | ||
|
|
||
| <div id="yarn"> | ||
| ```bash frame="none" | ||
| yarn add --dev tailwindcss@3 postcss autoprefixer | ||
| ``` | ||
| </div> | ||
|
|
||
| <div id="pnpm"> | ||
| ```bash frame="none" | ||
| pnpm add --save-dev tailwindcss@3 postcss autoprefixer | ||
| ``` | ||
| </div> | ||
|
|
||
| <div id="bun"> | ||
| ```bash frame="none" | ||
| bun add --save-dev tailwindcss@3 postcss autoprefixer | ||
| ``` | ||
| </div> | ||
| </TabsCodeBlocks> | ||
|
|
||
| 2. Next, run the init command to generate both `tailwind.config.js` and `postcss.config.js`. | ||
|
|
||
| <TabsCodeBlocks> | ||
| <div id="npm"> | ||
| ```bash frame="none" | ||
| npx tailwindcss init -p | ||
| ``` | ||
| </div> | ||
|
|
||
| <div id="yarn"> | ||
| ```bash frame="none" | ||
| yarn dlx tailwindcss init -p | ||
| ``` | ||
| </div> | ||
|
|
||
| <div id="pnpm"> | ||
| ```bash frame="none" | ||
| pnpm dlx tailwindcss init -p | ||
| ``` | ||
| </div> | ||
|
|
||
| <div id="bun"> | ||
| ```bash frame="none" | ||
| bunx tailwindcss init -p | ||
| ``` | ||
| </div> | ||
| </TabsCodeBlocks> | ||
|
|
||
| 3. Since TailwindCSS is configuration-driven, after initializing, a `tailwind.config.js` file will be created at the root of your project directory: | ||
|
|
||
| ```js | ||
| /** @type {import('tailwindcss').Config} */ | ||
| module.exports = { | ||
| content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"], | ||
| theme: { | ||
| extend: {}, | ||
| }, | ||
| plugins: [], | ||
| }; | ||
| ``` | ||
|
|
||
| For a deeper dive into configuration, you can check out the [Tailwind Official Documentation](https://tailwindcss.com/docs/configuration). | ||
|
|
||
| ## Add Tailwind directives | ||
|
|
||
| In your `src/index.css` file, add the following Tailwind directives: | ||
|
|
||
| ```css | ||
| @tailwind base; | ||
| @tailwind components; | ||
| @tailwind utilities; | ||
| ``` | ||
|
|
||
| These directives inform PostCSS that you're using Tailwind and establish the order of the directives. You can append custom CSS below these directives. | ||
|
|
||
| ## Import TailwindCSS | ||
|
|
||
| Import your `index.css` file into the root `index.jsx` or `index.tsx` file: | ||
|
|
||
| ```jsx | ||
| import { render } from "solid-js/web" | ||
| import App from "./App" | ||
| import "./index.css" | ||
|
|
||
| render(() => <App />, document.getElementById('root') as HTMLElement); | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| With Tailwind CSS set up, you can now utilize its utility classes. | ||
| For instance, if you previously had a `Card.css` file, you can replace or remove it: | ||
|
|
||
| ``` | ||
| /* src/components/Card.css */ | ||
| /* Remove or replace these styles with Tailwind utility classes */ | ||
| ``` | ||
|
|
||
| Update your components to use Tailwind's utility classes: | ||
|
|
||
| ```jsx | ||
| /* src/components/Card.jsx */ | ||
| function Card() { | ||
| return ( | ||
| <div class="grid place-items-center min-h-screen"> | ||
| <div class="h-[160px] aspect aspect-[2] rounded-[16px] shadow-[0_0_0_4px_hsl(0_0%_0%_/_15%)]"> | ||
| Hello, world! | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
| ``` | ||
|
|
||
| ## Support | ||
|
|
||
| For additional assistance, refer to the [Tailwind CSS/Vite integration guide](https://tailwindcss.com/docs/guides/vite). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.