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

@extending .class selectors leads to trouble for specific styling. #19162

Open
peebeebee opened this issue Aug 26, 2024 · 0 comments
Open

@extending .class selectors leads to trouble for specific styling. #19162

peebeebee opened this issue Aug 26, 2024 · 0 comments

Comments

@peebeebee
Copy link

peebeebee commented Aug 26, 2024

Describe the bug
Because the storefront is using @extend on classes that developers also use in their own codebase for the storefront.
This is the list that is causing trouble for selector sizes:\

.modal-dialog
.modal-dialog-centered
.modal-lg
.modal-content
.modal-header
.modal-body
.btn
.btn-link
.btn-sm
.btn-primary
.btn-block

For example, when a developer writes something like the following:

.some-site-specific-selector {
   .modal-dialog {
       background: red;
   }
}

This .modal-dialog ruleset will be added to all the places where .modal-dialog is extended in the original codebase.
See: https://webinista.com/updates/dont-use-extend-sass/ for a short explanation.
This leads to severe selector bloat in a lot of applications.

Tell us the version of Spartacus

  • Library version: 2211.25.x

To Reproduce
Steps to reproduce the behavior:

  1. Create a new component
  2. Add some styling inside the component that specifies/modifies the .btn or .modal-dialog selectors
  3. Check the styling

Desktop (please complete the following information):
N / A

Smartphone (please complete the following information):
N / A

Solution
Solution would be to only use extend on placeholders, not actual classes.
Search for @extend . in the codebase to see the offenders.

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

4 participants
@peebeebee and others