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-39
Original file line number
Diff line number
Diff line change
@@ -576,7 +576,6 @@ module.exports = {
576
576
loader:"css-loader",
577
577
options: {
578
578
modules: {
579
-
compileType:"module",
580
579
mode:"local",
581
580
auto:true,
582
581
exportGlobals:true,
@@ -594,38 +593,6 @@ module.exports = {
594
593
};
595
594
```
596
595
597
-
##### `compileType`
598
-
599
-
Type: `'module' | 'icss'`
600
-
Default: `'module'`
601
-
602
-
Controls the level of compilation applied to the input styles.
603
-
604
-
The `module` handles `class` and `id` scoping and `@value` values.
605
-
The `icss` will only compile the low level `Interoperable CSS` format for declaring `:import` and `:export` dependencies between CSS and other languages.
606
-
607
-
ICSS underpins CSS Module support, and provides a low level syntax for other tools to implement CSS-module variations of their own.
608
-
609
-
**webpack.config.js**
610
-
611
-
```js
612
-
module.exports= {
613
-
module: {
614
-
rules: [
615
-
{
616
-
test:/\.css$/i,
617
-
loader:"css-loader",
618
-
options: {
619
-
modules: {
620
-
compileType:"icss",
621
-
},
622
-
},
623
-
},
624
-
],
625
-
},
626
-
};
627
-
```
628
-
629
596
##### `auto`
630
597
631
598
Type: `Boolean|RegExp|Function`
@@ -637,7 +604,7 @@ Allows auto enable CSS modules based on filename.
637
604
638
605
Possible values:
639
606
640
-
-`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
607
+
-`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
641
608
-`false` - disables CSS modules or interoperable CSS format based on filename
642
609
643
610
**webpack.config.js**
@@ -715,9 +682,16 @@ Default: `'local'`
715
682
716
683
Setup `mode` option. You can omit the value when you want `local` mode.
717
684
685
+
Controls the level of compilation applied to the input styles.
686
+
687
+
The `local`, `global`, and `pure` handles `class` and `id` scoping and `@value` values.
688
+
The `icss` will only compile the low level `Interoperable CSS` format for declaring `:import` and `:export` dependencies between CSS and other languages.
689
+
690
+
ICSS underpins CSS Module support, and provides a low level syntax for other tools to implement CSS-module variations of their own.
691
+
718
692
###### `String`
719
693
720
-
Possible values - `local`, `global`, and `pure`.
694
+
Possible values - `local`, `global`, `pure`, and `icss`.
721
695
722
696
**webpack.config.js**
723
697
@@ -743,7 +717,7 @@ module.exports = {
743
717
744
718
Allows set different values for the `mode` option based on a filename
745
719
746
-
Possible return values - `local`, `global`, and `pure`.
720
+
Possible return values - `local`, `global`, `pure`and `icss`.
747
721
748
722
**webpack.config.js**
749
723
@@ -1343,7 +1317,7 @@ module.exports = {
1343
1317
1344
1318
### Separating `Interoperable CSS`-only and `CSS Module` features
1345
1319
1346
-
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.
1320
+
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.
1347
1321
Meanwhile all files matching `*.module.scss` are treated as `CSS Modules` in this example.
1348
1322
1349
1323
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