You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `css.transformer` option controls how CSS is processed. PostCSS and Lightning CSS are **mutually exclusive** processing paths:
189
189
190
-
-**`'postcss'`** (default): `@import` is resolved by [`postcss-import`](https://github.com/postcss/postcss-import), PostCSS plugins are applied, then Lightning CSS is used only for final syntax lowering and minification.
191
-
-**`'lightningcss'`**: `@import` is resolved by Lightning CSS's `bundleAsync()`, and PostCSS is **not used at all**.
190
+
-**`'lightningcss'`** (default): `@import` is resolved by Lightning CSS's `bundleAsync()`, and PostCSS is **not used at all**.
191
+
-**`'postcss'`**: `@import` is resolved by [`postcss-import`](https://github.com/postcss/postcss-import), PostCSS plugins are applied, then Lightning CSS is used only for final syntax lowering and minification.
192
192
193
193
```ts
194
194
exportdefaultdefineConfig({
195
195
css: {
196
-
transformer: 'lightningcss', // Use Lightning CSS for everything
196
+
transformer: 'postcss', // Use PostCSS for @import and plugins
197
197
},
198
198
})
199
199
```
200
200
201
-
When using the default `'postcss'` transformer, install `postcss` and optionally `postcss-import` for `@import` resolution:
201
+
When using the `'postcss'` transformer, install `postcss` and optionally `postcss-import` for `@import` resolution:
202
202
203
203
```bash
204
204
npm install -D postcss postcss-import
@@ -211,6 +211,7 @@ Configure PostCSS inline or point to a config file:
211
211
```ts
212
212
exportdefaultdefineConfig({
213
213
css: {
214
+
transformer: 'postcss',
214
215
postcss: {
215
216
plugins: [require('autoprefixer')],
216
217
},
@@ -223,12 +224,13 @@ Or specify a directory path to search for a PostCSS config file (`postcss.config
223
224
```ts
224
225
exportdefaultdefineConfig({
225
226
css: {
227
+
transformer: 'postcss',
226
228
postcss: './config', // Search for postcss.config.js in ./config/
227
229
},
228
230
})
229
231
```
230
232
231
-
When `css.postcss` is omitted, tsdown auto-detects PostCSS config from the project root.
233
+
When `css.postcss` is omitted and `transformer` is `'postcss'`, tsdown auto-detects PostCSS config from the project root.
0 commit comments