Skip to content

Commit 43dbe83

Browse files
authored
chore: update tailwindcssPath option docs (#58)
1 parent 01957bf commit 43dbe83

File tree

3 files changed

+31
-15
lines changed

3 files changed

+31
-15
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,30 @@ export default {
139139

140140
Note that `picomatch` patterns are very similar to [`minimatch`](https://github.com/isaacs/minimatch#readme) patterns, and in most use cases, they are interchangeable. If you have more specific pattern matching needs, you can view [this comparison table](https://github.com/micromatch/picomatch#library-comparisons) to learn more about where the libraries differ.
141141

142+
### `tailwindcssPath`
143+
144+
Specifies the absolute path to the tailwindcss package.
145+
146+
By default, tailwindcss is resolved using Node.js module resolution algorithm starting from the root path.
147+
148+
This option allows explicit specification of the tailwindcss package location for scenarios where automatic resolution fails or the resolved path is not correct, such as in monorepo.
149+
150+
- Type: `string | undefined`
151+
- Default: `undefined`
152+
153+
```js
154+
// rsbuild.config.ts
155+
import { pluginTailwindCSS } from 'rsbuild-plugin-tailwindcss'
156+
157+
export default {
158+
plugins: [
159+
pluginTailwindCSS({
160+
tailwindcssPath: require.resolve('tailwindcss'),
161+
}),
162+
],
163+
};
164+
```
165+
142166
## Debugging
143167

144168
Use `DEBUG='rsbuild'` to enable debugging mode for the plugin. When debugging is enabled, the plugin will:

src/TailwindCSSRspackPlugin.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ interface TailwindRspackPluginOptions {
149149
* Specifies the absolute path to the tailwindcss package.
150150
*
151151
* By default, tailwindcss is resolved using Node.js module resolution algorithm
152-
* starting from the project's root directory. This option allows explicit
152+
* starting from the root path. This option allows explicit
153153
* specification of the tailwindcss location for scenarios where automatic
154154
* resolution fails or the resolved path is not correct, such as in monorepo.
155155
*
@@ -160,11 +160,7 @@ interface TailwindRspackPluginOptions {
160160
* export default {
161161
* plugins: [
162162
* new TailwindRspackPlugin({
163-
* postcssOptions: {
164-
* plugins: {
165-
* tailwindcssPath: require.resolve('tailwindcss'),
166-
* },
167-
* },
163+
* tailwindcssPath: require.resolve('tailwindcss'),
168164
* }),
169165
* ],
170166
* }

src/index.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,22 +117,18 @@ export interface PluginTailwindCSSOptions {
117117
* Specifies the absolute path to the tailwindcss package.
118118
*
119119
* By default, tailwindcss is resolved using Node.js module resolution algorithm
120-
* starting from the project's root directory. This option allows explicit
120+
* starting from the root path. This option allows explicit
121121
* specification of the tailwindcss location for scenarios where automatic
122122
* resolution fails or the resolved path is not correct, such as in monorepo.
123123
*
124124
* ```js
125-
* // rspack.config.js
126-
* import { TailwindRspackPlugin } from 'rsbuild-plugin-tailwindcss'
125+
* // rsbuild.config.js
126+
* import { pluginTailwindCSS } from 'rsbuild-plugin-tailwindcss'
127127
*
128128
* export default {
129129
* plugins: [
130-
* new TailwindRspackPlugin({
131-
* postcssOptions: {
132-
* plugins: {
133-
* tailwindcssPath: require.resolve('tailwindcss'),
134-
* },
135-
* },
130+
* pluginTailwindCSS({
131+
* tailwindcssPath: require.resolve('tailwindcss'),
136132
* }),
137133
* ],
138134
* }

0 commit comments

Comments
 (0)