8c98a207f2
### What? This PR introduces a new `--tailwind` flag to the `create-next-app` CLI, to make it easier to bootstrap a Next.js app with Tailwind CSS pre-configured. This is going to be the **default**. To opt-out of Tailwind CSS, you can use the `--no-tailwind` flag. ### Why? Tailwind CSS is one of the most popular styling solutions right now, and we would like to make it easier to get started. Currently, the closest you can come to this is by running `pnpm create next-app -e with-tailwindcss` which will clone the https://github.com/vercel/next.js/tree/canary/examples/with-tailwindcss example. But that example is not configured for the App Router. This PR will let you add Tailwind CSS to both `app/`, `pages/`, and start out with TypeScript or JavaScript via the CLI prompts. (Some community feedback https://twitter.com/dev_jonaskaas/status/1632367991827443713, https://twitter.com/samselikoff/status/1634662473331617794) ### How? We are adding 4 new templates to the CLI bundle. > Note: The styling is not pixel-perfect compared to the current templates (using CSS modules) to require fewer overrides, but I tried to match it as close as possible. Here are a few screenshots: <details> <summary><b>Current, light</b></summary> <img src="https://user-images.githubusercontent.com/18369201/224733372-9dba86fe-9191-471d-ad9f-ab904c47f544.png"/> </details> <details> <summary><b>Tailwind (new), light</b></summary> <img src="https://user-images.githubusercontent.com/18369201/224733610-038d9d0f-634d-4b69-b5c2-a5056b56760c.png"/> </details> <details> <summary><b>Current, dark, responsive</b></summary> <img src="https://user-images.githubusercontent.com/18369201/224733790-9b4d730c-0336-4dbe-bc10-1cae1d7fd145.png"/> </details> <details> <summary><b>Tailwind (new), dark, responsive</b></summary> <img src="https://user-images.githubusercontent.com/18369201/224734375-28384bbc-2c3a-4125-8f29-c102f3b7aa1d.png"/> </details> #### For reviewers This introduces 4 new templates, with a very similar code base to the original ones. To keep the PR focused, I decided to copy over duplicate code, but we could potentially create a shared folder for files that are the same across templates to somewhat reduce the CLI size. Not sure if it's worth it, let me know. Probably fine for now, but something to consider if we are adding more permutations in the future. --- ~Work remaining:~ - [x] app+ts - [x] layout - [x] dark mode - [x] media queries - [x] animations - [x] app+js - [x] pages+ts - [x] pages+js - [x] prompt/config - [x] deprecate Tailwind CSS example in favor of CLI - [x] update docs - [x] add test - [x] add [Prettier plugin](https://github.com/tailwindlabs/prettier-plugin-tailwindcss) Closes NEXT-772 Related #45814, #44286 |
||
---|---|---|
.. | ||
3rd-party-module/pages | ||
basic-module/pages | ||
basic-module-include-paths | ||
basic-module-prepend-data | ||
catch-all-module/pages/[...post] | ||
compilation-and-prefixing | ||
composes-basic/pages | ||
composes-external/pages | ||
data-url | ||
dev-module/pages | ||
dynamic-route-module/pages/[post] | ||
external-url | ||
hmr-module/pages | ||
invalid-global | ||
invalid-global-module | ||
invalid-global-with-app | ||
invalid-module | ||
invalid-module-document | ||
loader-order | ||
multi-global | ||
multi-global-reversed | ||
multi-module/pages | ||
multi-page | ||
nested-global | ||
nm-module | ||
nm-module-nested | ||
npm-import | ||
npm-import-bad | ||
npm-import-nested | ||
prod-module/pages | ||
single-global | ||
single-global-src | ||
unused/pages | ||
url-global | ||
url-global-asset-prefix-1 | ||
url-global-asset-prefix-2 | ||
url-global-partial | ||
valid-and-invalid-global | ||
webpack-error | ||
with-styled-jsx | ||
next.config.js |