@@ -534,7 +534,7 @@ module.exports = {
534534 context: path .resolve (__dirname , ' src' ),
535535 localIdentHashPrefix: ' my-custom-hash' ,
536536 namedExport: true ,
537- localsConvention : ' camelCase' ,
537+ exportLocalsConvention : ' camelCase' ,
538538 exportOnlyLocals: false ,
539539 },
540540 },
@@ -758,55 +758,6 @@ module.exports = {
758758};
759759```
760760
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-
810761##### ` localIdentContext `
811762
812763Type: ` String `
@@ -861,14 +812,11 @@ module.exports = {
861812};
862813```
863814
864- ##### ` getLocalIdent `
815+ ##### ` localIdentRegExp `
865816
866- Type: ` Function `
817+ Type: ` String|RegExp `
867818Default: ` undefined `
868819
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-
872820** webpack.config.js**
873821
874822``` js
@@ -880,9 +828,7 @@ module.exports = {
880828 loader: ' css-loader' ,
881829 options: {
882830 modules: {
883- getLocalIdent : (context , localIdentName , localName , options ) => {
884- return ' whatever_random_class_name' ;
885- },
831+ localIdentRegExp: / page-(. * )\. css/ i ,
886832 },
887833 },
888834 },
@@ -891,11 +837,14 @@ module.exports = {
891837};
892838```
893839
894- ##### ` localIdentRegExp `
840+ ##### ` getLocalIdent `
895841
896- Type: ` String|RegExp `
842+ Type: ` Function `
897843Default: ` undefined `
898844
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+
899848** webpack.config.js**
900849
901850``` js
@@ -907,7 +856,9 @@ module.exports = {
907856 loader: ' css-loader' ,
908857 options: {
909858 modules: {
910- localIdentRegExp: / page-(. * )\. css/ i ,
859+ getLocalIdent : (context , localIdentName , localName , options ) => {
860+ return ' whatever_random_class_name' ;
861+ },
911862 },
912863 },
913864 },
@@ -968,6 +919,55 @@ module.exports = {
968919};
969920```
970921
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+
971971##### ` exportOnlyLocals `
972972
973973Type: ` Boolean `
0 commit comments