Skip to content
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

Support camelCase=only|dashesOnly #89

Closed
evisong opened this issue Mar 14, 2017 · 2 comments
Closed

Support camelCase=only|dashesOnly #89

evisong opened this issue Mar 14, 2017 · 2 comments

Comments

@evisong
Copy link

evisong commented Mar 14, 2017

Hi,

First of all, thanks for this fantastic lib, in our project we're heavily using babel-plugin-css-modules-transform, which is built on top of this lib.

Actually when setting camelCase=true, I found in bundled JS, camelCase classnames are generated, but the original classnames are not removed, e.g.:

var Styles = {
  'link': 'link-modules__link___3oOIo',
  'linkInGroup': 'link-modules__link-in-group___2fh2a',
  'linkInLinks': 'link-modules__link-in-links___3IT7k',
  'linkDisabled': 'link-modules__link-disabled___2qbP8',
  'link-in-group': 'link-modules__link-in-group___2fh2a',
  'link-in-links': 'link-modules__link-in-links___3IT7k',
  'link-disabled': 'link-modules__link-disabled___2qbP8'
};

This is somehow a duplicate. This may add about 70 kB bundle size when there is 1000 CSS Module classes in the project, which may be even larger in complex project. So I'm thinking if it's possible to just remove the original classnames in bundle.

Just found css-loader supported camelCase=only|dashesOnly (https://github.com/webpack-contrib/css-loader#camelcase) in this ticket webpack-contrib/css-loader#440 and PR webpack-contrib/css-loader#445

'only' Class names will be camelized, the original class name will be removed from the locals

'dashesOnly' Dashes in class names will be camelized, the original class name will be removed from the locals

Is it possible for css-modules-require-hook to support similar options?

Thanks.

@mightyaleksey
Copy link
Member

Thanks, I'll take a look into it.

@mightyaleksey mightyaleksey mentioned this issue Mar 19, 2017
@mightyaleksey
Copy link
Member

published in 4.0.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants