@@ -534,7 +534,7 @@ module.exports = {
534
534
context: path .resolve (__dirname , ' src' ),
535
535
localIdentHashPrefix: ' my-custom-hash' ,
536
536
namedExport: true ,
537
- localsConvention : ' camelCase' ,
537
+ exportLocalsConvention : ' camelCase' ,
538
538
exportOnlyLocals: false ,
539
539
},
540
540
},
@@ -758,55 +758,6 @@ module.exports = {
758
758
};
759
759
```
760
760
761
- ##### ` localsConvention `
762
-
763
- Type: ` String `
764
- Default: ` 'asIs' `
765
-
766
- Style of exported classnames.
767
-
768
- By default, the exported JSON keys mirror the class names (i.e ` asIs ` value).
769
-
770
- | Name | Type | Description |
771
- | :-------------------: | :--------: | :----------------------------------------------------------------------------------------------- |
772
- | ** ` 'asIs' ` ** | ` {String} ` | Class names will be exported as is. |
773
- | ** ` 'camelCase' ` ** | ` {String} ` | Class names will be camelized, the original class name will not to be removed from the locals |
774
- | ** ` 'camelCaseOnly' ` ** | ` {String} ` | Class names will be camelized, the original class name will be removed from the locals |
775
- | ** ` 'dashes' ` ** | ` {String} ` | Only dashes in class names will be camelized |
776
- | ** ` 'dashesOnly' ` ** | ` {String} ` | Dashes in class names will be camelized, the original class name will be removed from the locals |
777
-
778
- ** file.css**
779
-
780
- ``` css
781
- .class-name {
782
- }
783
- ```
784
-
785
- ** file.js**
786
-
787
- ``` js
788
- import { className } from ' file.css' ;
789
- ```
790
-
791
- ** webpack.config.js**
792
-
793
- ``` js
794
- module .exports = {
795
- module: {
796
- rules: [
797
- {
798
- test: / \. css$ / i ,
799
- loader: ' css-loader' ,
800
- options: {
801
- mode: ' local' ,
802
- localsConvention: ' camelCase' ,
803
- },
804
- },
805
- ],
806
- },
807
- };
808
- ```
809
-
810
761
##### ` localIdentContext `
811
762
812
763
Type: ` String `
@@ -861,14 +812,11 @@ module.exports = {
861
812
};
862
813
```
863
814
864
- ##### ` getLocalIdent `
815
+ ##### ` localIdentRegExp `
865
816
866
- Type: ` Function `
817
+ Type: ` String|RegExp `
867
818
Default: ` undefined `
868
819
869
- You can also specify the absolute path to your custom ` getLocalIdent ` function to generate classname based on a different schema.
870
- By default we use built-in function to generate a classname.
871
-
872
820
** webpack.config.js**
873
821
874
822
``` js
@@ -880,9 +828,7 @@ module.exports = {
880
828
loader: ' css-loader' ,
881
829
options: {
882
830
modules: {
883
- getLocalIdent : (context , localIdentName , localName , options ) => {
884
- return ' whatever_random_class_name' ;
885
- },
831
+ localIdentRegExp: / page-(. * )\. css/ i ,
886
832
},
887
833
},
888
834
},
@@ -891,11 +837,14 @@ module.exports = {
891
837
};
892
838
```
893
839
894
- ##### ` localIdentRegExp `
840
+ ##### ` getLocalIdent `
895
841
896
- Type: ` String|RegExp `
842
+ Type: ` Function `
897
843
Default: ` undefined `
898
844
845
+ You can also specify the absolute path to your custom ` getLocalIdent ` function to generate classname based on a different schema.
846
+ By default we use built-in function to generate a classname.
847
+
899
848
** webpack.config.js**
900
849
901
850
``` js
@@ -907,7 +856,9 @@ module.exports = {
907
856
loader: ' css-loader' ,
908
857
options: {
909
858
modules: {
910
- localIdentRegExp: / page-(. * )\. css/ i ,
859
+ getLocalIdent : (context , localIdentName , localName , options ) => {
860
+ return ' whatever_random_class_name' ;
861
+ },
911
862
},
912
863
},
913
864
},
@@ -968,6 +919,55 @@ module.exports = {
968
919
};
969
920
```
970
921
922
+ ##### ` exportlocalsConvention `
923
+
924
+ Type: ` String `
925
+ Default: ` 'asIs' `
926
+
927
+ Style of exported class names.
928
+
929
+ By default, the exported JSON keys mirror the class names (i.e ` asIs ` value).
930
+
931
+ | Name | Type | Description |
932
+ | :-------------------: | :--------: | :----------------------------------------------------------------------------------------------- |
933
+ | ** ` 'asIs' ` ** | ` {String} ` | Class names will be exported as is. |
934
+ | ** ` 'camelCase' ` ** | ` {String} ` | Class names will be camelized, the original class name will not to be removed from the locals |
935
+ | ** ` 'camelCaseOnly' ` ** | ` {String} ` | Class names will be camelized, the original class name will be removed from the locals |
936
+ | ** ` 'dashes' ` ** | ` {String} ` | Only dashes in class names will be camelized |
937
+ | ** ` 'dashesOnly' ` ** | ` {String} ` | Dashes in class names will be camelized, the original class name will be removed from the locals |
938
+
939
+ ** file.css**
940
+
941
+ ``` css
942
+ .class-name {
943
+ }
944
+ ```
945
+
946
+ ** file.js**
947
+
948
+ ``` js
949
+ import { className } from ' file.css' ;
950
+ ```
951
+
952
+ ** webpack.config.js**
953
+
954
+ ``` js
955
+ module .exports = {
956
+ module: {
957
+ rules: [
958
+ {
959
+ test: / \. css$ / i ,
960
+ loader: ' css-loader' ,
961
+ options: {
962
+ mode: ' local' ,
963
+ localsConvention: ' camelCase' ,
964
+ },
965
+ },
966
+ ],
967
+ },
968
+ };
969
+ ```
970
+
971
971
##### ` exportOnlyLocals `
972
972
973
973
Type: ` Boolean `
0 commit comments