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

camelCase doesn't delete original names #368

Closed
klimashkin opened this issue Nov 2, 2016 · 6 comments · Fixed by #445
Closed

camelCase doesn't delete original names #368

klimashkin opened this issue Nov 2, 2016 · 6 comments · Fixed by #445

Comments

@klimashkin
Copy link

camelCase option adds new props to style object, not replaces original ones.

It causes dirt when used with https://github.com/javivelasco/react-css-themr.

For instance, if I have .back-button {...} class, css-loader with camelCase returns

{
   back-button: '...',
   backButton: '...'
}

And if that style object is passed to react-css-themr as theme={styles} themeNamespace='back', it transforms it to

{
   -button: '...',
   button: '...'
}

It doesn't make any sense. Is there any reasons why original class name is saved by css-loader?

@timse
Copy link

timse commented Jan 21, 2017

this is most likely to keep being backword compatible etc.

why dont you just clean up the object before passing it along?

Object.keys(styles)
    .filter(style => style.indexOf('-') === -1)
    .reduce((cleanStyles, key) => {
        cleanStyles[key] = styles[key];
        return cleanStyles;
    }, {});

@klimashkin
Copy link
Author

@timse In thousand components? : )

@timse
Copy link

timse commented Jan 22, 2017

im sure you find a better way :)
but isn't it dangerous anyways to rely on two independent systems to provide correct data for each others api?
you would probably want to have some intermediate step between those two in case one of them changes its api anyways no?

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Mar 6, 2017

Will be fixed by #420

@joscha
Copy link
Contributor

joscha commented Mar 8, 2017

actually, will be fixed by #440 , #420 only removes the duplicate keys (cc @michael-ciniawsky )

@michael-ciniawsky
Copy link
Member

@joscha Alright 🤣 all my hopes are shattered

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

Successfully merging a pull request may close this issue.

5 participants