Skip to content

Commit 366d05a

Browse files
feat: exportLocalsStyle was remove in favor new localsConvention (#958)
BREAKING CHANGE: rename `exportLocalsStyle` option to `localsConvention` option
1 parent aa75fa7 commit 366d05a

11 files changed

+276
-276
lines changed

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ module.exports = {
109109

110110
## Options
111111

112-
| Name | Type | Default | Description |
113-
| :-------------------------------------------: | :-------------------------: | :-----: | :------------------------------------------------- |
114-
| **[`url`](#url)** | `{Boolean\|Function}` | `true` | Enable/Disable `url()` handling |
115-
| **[`import`](#import)** | `{Boolean\|Function}` | `true` | Enable/Disable @import handling |
116-
| **[`modules`](#modules)** | `{Boolean\|String\|Object}` | `false` | Enable/Disable CSS Modules and setup their options |
117-
| **[`sourceMap`](#sourcemap)** | `{Boolean}` | `false` | Enable/Disable Sourcemaps |
118-
| **[`importLoaders`](#importloaders)** | `{Number}` | `0` | Number of loaders applied before CSS loader |
119-
| **[`exportLocalsStyle`](#exportlocalsstyle)** | `{String}` | `asIs` | Setup style of exported classnames |
120-
| **[`onlyLocals`](#onlylocals)** | `{Boolean}` | `false` | Export only locals |
112+
| Name | Type | Default | Description |
113+
| :-----------------------------------------: | :-------------------------: | :-----: | :------------------------------------------------- |
114+
| **[`url`](#url)** | `{Boolean\|Function}` | `true` | Enable/Disable `url()` handling |
115+
| **[`import`](#import)** | `{Boolean\|Function}` | `true` | Enable/Disable @import handling |
116+
| **[`modules`](#modules)** | `{Boolean\|String\|Object}` | `false` | Enable/Disable CSS Modules and setup their options |
117+
| **[`sourceMap`](#sourcemap)** | `{Boolean}` | `false` | Enable/Disable Sourcemaps |
118+
| **[`importLoaders`](#importloaders)** | `{Number}` | `0` | Number of loaders applied before CSS loader |
119+
| **[`localsConvention`](#localsconvention)** | `{String}` | `asIs` | Setup style of exported classnames |
120+
| **[`onlyLocals`](#onlylocals)** | `{Boolean}` | `false` | Export only locals |
121121

122122
### `url`
123123

@@ -763,7 +763,7 @@ module.exports = {
763763

764764
This may change in the future when the module system (i. e. webpack) supports loader matching by origin.
765765

766-
### `exportLocalsStyle`
766+
### `localsConvention`
767767

768768
Type: `String`
769769
Default: `undefined`
@@ -801,7 +801,7 @@ module.exports = {
801801
test: /\.css$/i,
802802
loader: 'css-loader',
803803
options: {
804-
exportLocalsStyle: 'camelCase',
804+
localsConvention: 'camelCase',
805805
},
806806
},
807807
],

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default function loader(content, map, meta) {
6464
icssParser({
6565
loaderContext: this,
6666
importPrefix,
67-
exportLocalsStyle: options.exportLocalsStyle,
67+
localsConvention: options.localsConvention,
6868
})
6969
);
7070

src/options.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
}
8585
]
8686
},
87-
"exportLocalsStyle": {
87+
"localsConvention": {
8888
"anyOf": [
8989
{
9090
"type": "string",

src/plugins/postcss-icss-parser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default postcss.plugin(
6767

6868
result.messages.push({
6969
pluginName,
70-
export: getExportItemCode(name, value, options.exportLocalsStyle),
70+
export: getExportItemCode(name, value, options.localsConvention),
7171
type: 'export',
7272
item: { name, value },
7373
});

src/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -253,15 +253,15 @@ function getModuleCode(result, sourceMap, onlyLocals) {
253253
)}, ""${sourceMap && result.map ? `,${result.map}` : ''}]);\n`;
254254
}
255255

256-
function getExportItemCode(key, value, localsStyle) {
256+
function getExportItemCode(key, value, localsConvention) {
257257
let targetKey;
258258
const items = [];
259259

260260
function addEntry(k) {
261261
items.push(`\t${JSON.stringify(k)}: ${JSON.stringify(value)}`);
262262
}
263263

264-
switch (localsStyle) {
264+
switch (localsConvention) {
265265
case 'camelCase':
266266
addEntry(key);
267267
targetKey = camelCase(key);

test/__snapshots__/exportLocalsStyle-option.test.js.snap

-241
This file was deleted.

0 commit comments

Comments
 (0)