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
Copy file name to clipboardExpand all lines: README.md
+13-39Lines changed: 13 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -577,7 +577,6 @@ module.exports = {
577
577
loader:"css-loader",
578
578
options: {
579
579
modules: {
580
-
compileType:"module",
581
580
mode:"local",
582
581
auto:true,
583
582
exportGlobals:true,
@@ -595,38 +594,6 @@ module.exports = {
595
594
};
596
595
```
597
596
598
-
##### `compileType`
599
-
600
-
Type: `'module' | 'icss'`
601
-
Default: `'module'`
602
-
603
-
Controls the level of compilation applied to the input styles.
604
-
605
-
The `module` handles `class` and `id` scoping and `@value` values.
606
-
The `icss` will only compile the low level `Interoperable CSS` format for declaring `:import` and `:export` dependencies between CSS and other languages.
607
-
608
-
ICSS underpins CSS Module support, and provides a low level syntax for other tools to implement CSS-module variations of their own.
609
-
610
-
**webpack.config.js**
611
-
612
-
```js
613
-
module.exports= {
614
-
module: {
615
-
rules: [
616
-
{
617
-
test:/\.css$/i,
618
-
loader:"css-loader",
619
-
options: {
620
-
modules: {
621
-
compileType:"icss",
622
-
},
623
-
},
624
-
},
625
-
],
626
-
},
627
-
};
628
-
```
629
-
630
597
##### `auto`
631
598
632
599
Type: `Boolean|RegExp|Function`
@@ -638,7 +605,7 @@ Allows auto enable CSS modules based on filename.
638
605
639
606
Possible values:
640
607
641
-
-`true` - enables CSS modules or interoperable CSS format, sets the [`modules.compileType`](#compiletype) option to `module` value for all files which satisfy `/\.module(s)?\.\w+$/i.test(filename)` condition or sets the [`modules.compileType`](#compiletype) option to `icss` value for all files which satisfy `/\.icss\.\w+$/i.test(filename)` condition
608
+
-`true` - enables CSS modules or interoperable CSS format, sets the [`modules.mode`](#mode) option to `local` value for all files which satisfy `/\.module(s)?\.\w+$/i.test(filename)` condition or sets the [`modules.mode`](#mode) option to `icss` value for all files which satisfy `/\.icss\.\w+$/i.test(filename)` condition
642
609
-`false` - disables CSS modules or interoperable CSS format based on filename
643
610
644
611
**webpack.config.js**
@@ -716,9 +683,16 @@ Default: `'local'`
716
683
717
684
Setup `mode` option. You can omit the value when you want `local` mode.
718
685
686
+
Controls the level of compilation applied to the input styles.
687
+
688
+
The `local`, `global`, and `pure` handles `class` and `id` scoping and `@value` values.
689
+
The `icss` will only compile the low level `Interoperable CSS` format for declaring `:import` and `:export` dependencies between CSS and other languages.
690
+
691
+
ICSS underpins CSS Module support, and provides a low level syntax for other tools to implement CSS-module variations of their own.
692
+
719
693
###### `String`
720
694
721
-
Possible values - `local`, `global`, and `pure`.
695
+
Possible values - `local`, `global`, `pure`, and `icss`.
722
696
723
697
**webpack.config.js**
724
698
@@ -744,7 +718,7 @@ module.exports = {
744
718
745
719
Allows set different values for the `mode` option based on a filename
746
720
747
-
Possible return values - `local`, `global`, and `pure`.
721
+
Possible return values - `local`, `global`, `pure`and `icss`.
748
722
749
723
**webpack.config.js**
750
724
@@ -1312,7 +1286,7 @@ module.exports = {
1312
1286
1313
1287
### Separating `Interoperable CSS`-only and `CSS Module` features
1314
1288
1315
-
The following setup is an example of allowing `Interoperable CSS` features only (such as `:import` and `:export`) without using further `CSS Module` functionality by setting `compileType` option for all files that do not match `*.module.scss` naming convention. This is for reference as having `ICSS` features applied to all files was default `css-loader` behavior before v4.
1289
+
The following setup is an example of allowing `Interoperable CSS` features only (such as `:import` and `:export`) without using further `CSS Module` functionality by setting `mode` option for all files that do not match `*.module.scss` naming convention. This is for reference as having `ICSS` features applied to all files was default `css-loader` behavior before v4.
1316
1290
Meanwhile all files matching `*.module.scss` are treated as `CSS Modules` in this example.
1317
1291
1318
1292
An example case is assumed where a project requires canvas drawing variables to be synchronized with CSS - canvas drawing uses the same color (set by color name in JavaScript) as HTML background (set by class name in CSS).
0 commit comments