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

Compose classes with attribute selector #393

Open
tnyo43 opened this issue Jun 20, 2023 · 0 comments
Open

Compose classes with attribute selector #393

tnyo43 opened this issue Jun 20, 2023 · 0 comments

Comments

@tnyo43
Copy link

tnyo43 commented Jun 20, 2023

Hi, I faced a problem while using the selector composition, but I don't figure out that if it follows the specifications or not.

I defined classes as like follows:

[class^='stack-'] {
  display: flex;
  flex-direction: column;
}

.stack-8 {
  gap: 8px;
}

I created a css file and a React component as like follows:

/* index.module.css */
.container {
  composes: stack-8 from global;
}
import styles from './index.module.css';

const Container = ({ children }) => <div className={styles.container}>{children}</div>

Then, I found that the gap: 8px declaration is appropriately reflected but display: flex; flex-direction: column; declarations are not.


I created a repro https://github.com/tnyo43/css-module-with-attribute-selector-sample

  1. run npm install
  2. run npm storybook
  3. go to http://localhost:6006/?path=/story/containerwithcomposing--default . You will see that the selector composition doesn't work well.
    3.1. You can see that stack-8 itself works well on http://localhost:6006/?path=/story/container--default
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

1 participant