-
-
Notifications
You must be signed in to change notification settings - Fork 608
Added camelCase option #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👍 |
👍 nice |
@sokra ping |
Can You keep both versions(original, camelCase) in result scope? /* styles.css */
.btn-info {
color: blue;
}
.is-loading {
color: red;
} // app.js
const styles = require('!css?modules&camelCase!./styles.css');
const cx = require('classnames/bind').bind(styles);
// as strings
const classNamesA = cx('btn-info', 'is-loading');
// as logical notation
const classNamesB = cx('btn-info', { isLoading : true });
const isLoading = true;
const classNamesC = cx('btn-info', { isLoading });
console.log(classNamesA) // => "__btn-info___xCfnx __is-loading___3sOhl"
console.log(classNamesB) // => "__btn-info___xCfnx __is-loading___3sOhl"
console.log(classNamesC) // => "__btn-info___xCfnx __is-loading___3sOhl" |
👍 |
great feature |
@sokra ping |
@sokra done |
Thanks |
It should be move from |
@faergeek yep. I'm working on this. |
Cool, it should probably just be factored out from Cool feature, BTW 👍 |
Would be cool to have possibility to use camelCase which replaces only dashes, leaving underscores alone, what do you think? |
@faergeek now it's keeping both variants. |
I mean if we have class like |
I could contribute this functionality into your fork |
Or I could just make a separate PR which will add it to |
@faergeek I've published new PR. |
Yes, but probably use another name for that or just alias it ( |
Just don't use BEM when using CSS Modules. That makes no sense. Instead of |
@sokra I think it's still convenient to distinguish between element and modifier. So I can have multiple elements with |
ok, you are propably right. |
@sokra @nkt would it be possible to introduce yet another flag which removes the uncamelized version? Basically, by retaining both the camelized and original versions of a classname, the bundle size increases, sometimes by a lot for larger projects. If all developers are in with the syntax, perhaps it'd not be as problematic to remove the original classnames? Two extra options can be added to the |
@sokra focuses on webpack and core integrations. A merged pull request from a year ago is not the place to be asking for an enhancement. Create a new issue so it can be properly triaged by the correct group of people. |
This patch helps developers use
css-modules
with external libraries, like bootstrap. Popular css frameworks use kebab-case (bootstrap, foundation), or maybe other, like snake_case. We can resolve this problem if would automatically convert them to camelCase.