Skip to content

Commit

Permalink
update with-turbopack example for postcss/tailwind support (#44261)
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Dec 22, 2022
1 parent 0572e21 commit 3020c44
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 21 deletions.
16 changes: 1 addition & 15 deletions examples/with-turbopack/README.md
Expand Up @@ -11,21 +11,7 @@ This playground is a mirror of the [Next.js v13 App Directory Playground](https:
1. Install dependencies: `yarn`
1. Start the dev server: `yarn dev`

**Note:** The playground uses [Tailwind CSS](https://tailwindcss.com). However, Turbopack does not yet support fully [PostCSS](https://turbo.build/pack/docs/features/css#postcss), but it does support CSS and CSS Modules. [As a workaround](https://turbo.build/pack/docs/features/css#tailwind-css), we run Tailwind through it's CLI upon `postinstall`. For live reload of CSS, you can run Tailwind in another process with the `--watch` flag or install `concurrently` and modify your `dev` script:

```bash
yarn add concurrently --dev
```

Then modify your `dev` script in `package.json`:

```json
{
"scripts": {
"dev": "concurrently \"next dev --turbo\" \"npm run tailwind --watch\""
}
}
```
**Note:** The playground uses [Tailwind CSS](https://tailwindcss.com) via [PostCSS](https://turbo.build/pack/docs/features/css#postcss).

For more information, see: https://turbo.build/pack/docs/features/css#tailwind-css

Expand Down
2 changes: 1 addition & 1 deletion examples/with-turbopack/app/layout.tsx
@@ -1,4 +1,4 @@
import '@/styles/dist.css';
import '@/styles/globals.css';
import React from 'react';
import AddressBar from '@/ui/AddressBar';
import GlobalNav from './GlobalNav';
Expand Down
6 changes: 1 addition & 5 deletions examples/with-turbopack/package.json
Expand Up @@ -2,13 +2,10 @@
"private": true,
"scripts": {
"dev": "next dev --turbo",
"dev:tailwind": "concurrently \"next dev --turbo\" \"npm run tailwind -- --watch\"",
"build": "next build",
"start": "next start",
"lint": "next lint",
"tailwind": "tailwindcss -i styles/globals.css -o styles/dist.css",
"format": "prettier --write \"**/*.{js,ts,tsx,md}\"",
"postinstall": "npm run tailwind"
"format": "prettier --write \"**/*.{js,ts,tsx,md}\""
},
"prettier": {
"arrowParens": "always",
Expand All @@ -18,7 +15,6 @@
},
"dependencies": {
"clsx": "1.2.1",
"concurrently": "7.5.0",
"next": "latest",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
6 changes: 6 additions & 0 deletions examples/with-turbopack/postcss.config.js
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

0 comments on commit 3020c44

Please sign in to comment.