Skip to content

eliminate useless dynamic classes, store reference to folded componentStyle#3236

Merged
quantizor merged 9 commits into
masterfrom
replace-folded-amp
Aug 27, 2020
Merged

eliminate useless dynamic classes, store reference to folded componentStyle#3236
quantizor merged 9 commits into
masterfrom
replace-folded-amp

Conversation

@quantizor
Copy link
Copy Markdown
Contributor

@quantizor quantizor commented Aug 27, 2020

Fixes #3206

  1. this effectively deduplicates a lot of redundant CSS that is generated
    starting with v4

  2. & self-references are now correctly resolved to the folded layer they
    correspond to

@quantizor quantizor requested review from kitten and mxstbr August 27, 2020 16:23
@quantizor
Copy link
Copy Markdown
Contributor Author

quantizor commented Aug 27, 2020

Published as styled-components@5.2.0-test.2 for testing (or styled-components@test)

@quantizor
Copy link
Copy Markdown
Contributor Author

This doesn't quite fix #3206 yet, just realized the selectors for composed self-references need to be based on the OG static class name...

Comment thread .vscode/extensions.json
@@ -0,0 +1,8 @@
{
"recommendations": [
"christian-kohler.path-intellisense",
Copy link
Copy Markdown
Member

@kitten kitten Aug 27, 2020

Choose a reason for hiding this comment

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

Accidental change?

Copy link
Copy Markdown
Contributor Author

@quantizor quantizor Aug 27, 2020

Choose a reason for hiding this comment

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

No, just decided to add it in while I was doing other stuff 😅

Comment thread packages/styled-components/src/models/StyledComponent.js
kitten
kitten previously approved these changes Aug 27, 2020
…tStyle

1. this effectively deduplicates a lot of redundant CSS that is generated
   starting with v4

2. & self-references are now correctly resolved to the folded layer they
   corespond to
The engines >= 8 thing hasn't been released yet, so this is not
considered a breaking change.
@Zenser
Copy link
Copy Markdown

Zenser commented Dec 7, 2022

@probablyup hi, i see this #2071 use for style isolate.

// Comp -> .sc-a
// color: red -> .a
// color: blue -> .b

.sc-a {}
.a { color: red }
.a + .sc-a { margin-left: 10px }
.b { color: blue }
.b + .sc-a { margin-left: 10px }

It is useful for me, and now how do style isolate?

Has many styled-components instants in one container at my case. Thanks for your callback.

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

Successfully merging this pull request may close these issues.

Complex selectors with ampersands break after the component is extended.

3 participants