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

Leverage CSS cascade layers to fix and user-proof styles order #529

Merged
merged 3 commits into from
Mar 27, 2024

Conversation

adamkudrna
Copy link
Member

@adamkudrna adamkudrna commented Mar 6, 2024

As long as layers.scss (layers order definition) is called first, our Sass styles can be imported in any order.

It solves the incorrect (but unavoidable, due to the way we compile CSS) call order of styles in our index.js.

Also, developers can now extend the CSS cascade instead of just prepending or appending their styles to ours.

For example:

/* My custom app styles */
@layer foundation.elements {
  code {
    background-color: silver;
  }
}

⚠️ Breaking Changes

  • Custom unlayered stylesheets are ordered after the (layered) RUI stylesheets, no matter where they are defined.
  • Since all Sass files handled by CSS Modules are now named *.module.scss, the development class names have been renamed from <ComponentName>__<hash> to <ComponentName>-module__<hash>.

Closes #518.

@adamkudrna adamkudrna requested a review from dacerondrej March 6, 2024 21:24
@adamkudrna adamkudrna self-assigned this Mar 6, 2024
@adamkudrna adamkudrna linked an issue Mar 6, 2024 that may be closed by this pull request
@bedrich-schindler
Copy link
Contributor

Just wow!

Base automatically changed from docs/css-usage to master March 8, 2024 17:22
@adamkudrna adamkudrna force-pushed the feature/css-cascade-layers branch from 8a3a9a1 to a5f44b0 Compare March 8, 2024 17:26
@adamkudrna adamkudrna force-pushed the feature/css-cascade-layers branch from a5f44b0 to 2c19ce8 Compare March 8, 2024 22:07
@adamkudrna adamkudrna requested a review from mbohal March 8, 2024 23:02
Copy link
Contributor

@bedrich-schindler bedrich-schindler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, Table is not working in this branch. master is OK.

313993940-02e712c7-4a77-4e3b-9039-2f0858c252bd

@adamkudrna
Copy link
Member Author

For some reason, Table is not working in this branch. master is OK.

Fixed, I forgot to rename nested TableCell styles.

`css-loader` now only treats `*.module.*` files as CSS Modules.
@adamkudrna adamkudrna force-pushed the feature/css-cascade-layers branch from a01148d to e466d3f Compare March 27, 2024 12:26
@adamkudrna adamkudrna force-pushed the feature/css-cascade-layers branch from e466d3f to 789560c Compare March 27, 2024 14:45
As long as `layers.scss` (layers order definition) is called first, our Sass
styles can be imported in any order.

It solves the incorrect (but unavoidable, due to the way we compile CSS) call
order of styles in our `index.js`.

Also, developers can now extend the CSS cascade instead of just prepending or
appending their styles to ours.

For example:

```css
/* My custom app styles */
@layer foundation.elements {
  code {
    background-color: silver;
  }
}
```
@adamkudrna adamkudrna force-pushed the feature/css-cascade-layers branch from 789560c to 45212f3 Compare March 27, 2024 14:49
@adamkudrna adamkudrna merged commit 2430fdf into master Mar 27, 2024
10 checks passed
@adamkudrna adamkudrna deleted the feature/css-cascade-layers branch March 27, 2024 14:50
@adamkudrna adamkudrna added the BC Breaking change label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BC Breaking change feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Leverage CSS cascade layers to fix and user-proof styles order
4 participants