Skip to content

Commit 8fdc086

Browse files
committed
small update + readme note
1 parent c4e4d89 commit 8fdc086

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ hook({
183183
});
184184
```
185185

186+
### `camelCase boolean`
187+
188+
Camelizes exported class names. Similar to [css-loader?camelCase](https://github.com/webpack/css-loader#camel-case).
189+
186190
### `append` array
187191

188192
Appends custom plugins to the end of the PostCSS pipeline. Since the `require` function is synchronous, you should provide synchronous plugins only.

lib/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const globToRegex = require('glob-to-regexp');
66
const identity = require('lodash').identity;
77
const negate = require('lodash').negate;
88
const camelCaseFunc = require('lodash').camelCase;
9+
const mapKeys = require('lodash').mapKeys;
910
const readFileSync = require('fs').readFileSync;
1011
const relative = require('path').relative;
1112
const resolve = require('path').resolve;
@@ -106,8 +107,7 @@ module.exports = function setupHook({
106107
tokens = lazyResult.root.tokens;
107108

108109
if (camelCase) {
109-
tokens = Object.assign({}, tokens,
110-
...Object.keys(tokens).map(key => ({ [camelCaseFunc(key)]: tokens[key] })))
110+
tokens = assign(mapKeys(tokens, (value, key) => camelCaseFunc(key)), tokens);
111111
}
112112

113113
if (!debugMode) {

0 commit comments

Comments
 (0)