Skip to content

Doesn't allow composition into single global classname. #159

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

Closed
tj opened this issue Sep 11, 2016 · 2 comments
Closed

Doesn't allow composition into single global classname. #159

tj opened this issue Sep 11, 2016 · 2 comments

Comments

@tj
Copy link

tj commented Sep 11, 2016

For this project I'm using global css instead of local, but composes seems busted:

.Card {
  composes: small from "./shadows.css";
}

yields the following error:

  Error: composition is only allowed when selector is single :local class name not in ".Card", ".Card" is weird

I've done similar with the local-first behaviour and it seemed fine, but that's not the case with global apparently.

Not sure which module actually holds the composition stuff but these are the versions:

└─┬ [email protected]
  ├─┬ [email protected]
  │ ├── [email protected]
  │ ├─┬ [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ ├─┬ [email protected]
  │ │ └─┬ [email protected]
  │ │   ├── [email protected]
  │ │   ├── [email protected]
  │ │   └─┬ [email protected]
  │ │     ├── [email protected]
  │ │     ├── [email protected]
  │ │     └─┬ [email protected]
  │ │       └── [email protected]
  │ ├── [email protected]
  │ └── [email protected]

Any tips would be great!

@geelen
Copy link
Member

geelen commented Sep 12, 2016

Yeah you can't use composes inside a global class. Composition works by exporting an extra class along with your local class (it doesn't rewrite the CSS at all), but global classes don't export anything so there's nothing to attach the extra export to.

Same reason why .localClass > * { composes: x from "./y.css"; } doesn't work. Since CSS Modules is all about classes, there's no way to attach classes to the elements targeted by .localClass > *

There's a much bigger discussion on the point over here at css-modules/css-modules#33 (comment) where I go into it in a bit more depth. Hope that helps!

@tj
Copy link
Author

tj commented Sep 12, 2016

ahhh I see, thanks that makes sense!

@tj tj closed this as completed Sep 12, 2016
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