Skip to content

Commit

Permalink
docs(react): update tailwind guide (nrwl#11208)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo authored Jul 19, 2022
1 parent c3bd976 commit 10316d9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/shared/guides/using-tailwind-css-in-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,31 @@ Next, import tailwind styles to the application's base `styles.css` or `styles.s
@tailwind base;
@tailwind utilities;
```

## Step 4: Applying configuration to libraries

Lastly, let's update the application's project configuration to point to the `postcss.config.js` file that we created in [step 2](#step-2:-initialize-tailwind).

Open up the `apps/{your app here}/project.json` file and add the following to the build target.

```json lines
{
// ...
"targets": {
"build": {
"executor": "@nrwl/web:webpack",
"options": {
// ...
"postcssConfig": "apps/{your app here}/postcss.config.js"
}
}
}
// ...
}
```

By specifying the `postcssConfig` option, the PostCSS and Tailwind configuration will be applied to all libraries used by the application as well.

{% callout type="note" title="Using library-specific configuration files" %}
If your libraries have their own `postcss.config.js` and `tailwind.config.js` files then you should not use the `postcssConfig` option. Doing so will ignore the library-specific configuration and apply the application's configuration to everything.
{%/ callout %}

0 comments on commit 10316d9

Please sign in to comment.