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
|[`execute`](#execute)|`{Boolean}`|`undefined`| Enable PostCSS Parser support in `CSS-in-JS`|
148
-
|[`postcssOptions`](#postcssOptions)|`{Object\|Function}`|`defaults values for Postcss.process`| Set `PostCSS` options and plugins |
149
-
|[`sourceMap`](#sourcemap)|`{Boolean}`|`compiler.devtool`| Enables/Disables generation of source maps |
150
-
|[`implementation`](#implementation)|`{Function\|String}`|`postcss`| Setup PostCSS implementation to use |
145
+
-[`execute`](#execute)
146
+
-[`postcssOptions`](#postcssOptions)
147
+
-[`sourceMap`](#sourcemap)
148
+
-[`implementation`](#implementation)
151
149
152
150
### `execute`
153
151
154
-
Type: `Boolean`
152
+
Type:
153
+
154
+
```ts
155
+
typeexecute=boolean;
156
+
```
157
+
155
158
Default: `undefined`
156
159
160
+
Enable PostCSS Parser support in `CSS-in-JS`.
157
161
If you use JS styles the [`postcss-js`](https://github.com/postcss/postcss-js) parser, add the `execute` option.
158
162
159
163
**webpack.config.js**
@@ -187,7 +191,28 @@ module.exports = {
187
191
188
192
### `postcssOptions`
189
193
190
-
Type: `Object|Function`
194
+
Type:
195
+
196
+
```ts
197
+
typepostcssOptions=
198
+
| {
199
+
from:string;
200
+
map:boolean|SourceMapOptions;
201
+
parser:string|object| (() =>Parser);
202
+
stringifier:Stringifier|Syntax;
203
+
syntax:Syntax;
204
+
to:string;
205
+
}
206
+
| ((loaderContext:LoaderContext) => {
207
+
from:string;
208
+
map:boolean|SourceMapOptions;
209
+
parser:string|object| (() =>Parser);
210
+
stringifier:Stringifier|Syntax;
211
+
syntax:Syntax;
212
+
to:string;
213
+
});
214
+
```
215
+
191
216
Default: `undefined`
192
217
193
218
Allows to set [`PostCSS options`](https://postcss.org/api/#processoptions) and plugins.
@@ -198,7 +223,7 @@ There is the special `config` option for config files. How it works and how it c
198
223
We recommend do not specify `from`, `to` and `map` options, because this can lead to wrong path in source maps.
199
224
If you need source maps please use the [`sourcemap`](#sourcemap) option.
200
225
201
-
#### `Object`
226
+
#### `object`
202
227
203
228
Setup `plugins`:
204
229
@@ -267,9 +292,9 @@ module.exports = {
267
292
loader:"postcss-loader",
268
293
options: {
269
294
postcssOptions: {
270
-
// Can be `String`
295
+
// Can be `string`
271
296
syntax:"sugarss",
272
-
// Can be `Object`
297
+
// Can be `object`
273
298
syntax:require("sugarss"),
274
299
},
275
300
},
@@ -292,11 +317,11 @@ module.exports = {
292
317
loader:"postcss-loader",
293
318
options: {
294
319
postcssOptions: {
295
-
// Can be `String`
320
+
// Can be `string`
296
321
parser:"sugarss",
297
-
// Can be `Object`
322
+
// Can be `object`
298
323
parser:require("sugarss"),
299
-
// Can be `Function`
324
+
// Can be `function`
300
325
parser:require("sugarss").parse,
301
326
},
302
327
},
@@ -322,11 +347,11 @@ module.exports = {
322
347
loader:"postcss-loader",
323
348
options: {
324
349
postcssOptions: {
325
-
// Can be `String`
350
+
// Can be `string`
326
351
stringifier:"sugarss",
327
-
// Can be `Object`
352
+
// Can be `object`
328
353
stringifier:require("sugarss"),
329
-
// Can be `Function`
354
+
// Can be `function`
330
355
stringifier:midas.stringifier,
331
356
},
332
357
},
@@ -336,7 +361,7 @@ module.exports = {
336
361
};
337
362
```
338
363
339
-
#### `Function`
364
+
#### `function`
340
365
341
366
**webpack.config.js**
342
367
@@ -375,7 +400,12 @@ module.exports = {
375
400
376
401
#### `config`
377
402
378
-
Type: `Boolean|String`
403
+
Type:
404
+
405
+
```ts
406
+
typeconfig=boolean|string;
407
+
```
408
+
379
409
Default: `undefined`
380
410
381
411
Allows to set options using config files.
@@ -392,7 +422,7 @@ The loader will search up the directory tree for configuration in the following
392
422
393
423
##### Examples of Config Files
394
424
395
-
Using `Object` notation:
425
+
Using `object` notation:
396
426
397
427
**postcss.config.js** (**recommend**)
398
428
@@ -408,7 +438,7 @@ module.exports = {
408
438
};
409
439
```
410
440
411
-
Using `Function` notation:
441
+
Using `function` notation:
412
442
413
443
**postcss.config.js** (**recommend**)
414
444
@@ -509,7 +539,7 @@ module.exports = {
509
539
};
510
540
```
511
541
512
-
#### Boolean
542
+
#### `boolean`
513
543
514
544
Enables/Disables autoloading config.
515
545
@@ -561,7 +591,12 @@ module.exports = {
561
591
562
592
### `sourceMap`
563
593
564
-
Type: `Boolean`
594
+
Type:
595
+
596
+
```ts
597
+
typesourceMap=boolean;
598
+
```
599
+
565
600
Default: depends on the `compiler.devtool` value
566
601
567
602
By default generation of source maps depends on the [`devtool`](https://webpack.js.org/configuration/devtool/) option.
@@ -612,14 +647,21 @@ module.exports = {
612
647
613
648
### `implementation`
614
649
615
-
Type: `Function | String`
650
+
Type:
651
+
652
+
```ts
653
+
typeimplementation=object;
654
+
```
655
+
656
+
type of `implementation` should be the same as [postcss.d.ts](https://github.com/postcss/postcss/blob/main/lib/postcss.d.ts)
657
+
616
658
Default: `postcss`
617
659
618
660
The special `implementation` option determines which implementation of PostCSS to use. Overrides the locally installed `peerDependency` version of `postcss`.
619
661
620
662
**This option is only really useful for downstream tooling authors to ease the PostCSS 7-to-8 transition.**
0 commit comments