-
Notifications
You must be signed in to change notification settings - Fork 387
Improved media query sorting #1438
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
workflow: benchmarks/perfComparison of performance test results, measured in operations per second. Larger is better.
|
workflow: benchmarks/sizeComparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.
|
bd9b294 to
0907967
Compare
mellyeliu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple changes! Let's also add this behind a config within processStylexRules so we can roll it out easily - there are breakpoints that will shift internally.
| 0: { | ||
| className: "xrvj5dj x1rkzygb x7k18q3 x17lh93j xmr4b4k xesbpuc x15nfgh4", | ||
| "data-style-src": "../../../../../../../../../html/js/FooBar.react.js:11; ../../../../../../../../../html/js/FooBar.react.js:16" | ||
| "data-style-src": "../../../../../../../html/js/FooBar.react.js:11; ../../../../../../../html/js/FooBar.react.js:16" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are irrelevant, you might need to do a clean yarn install
| return classname1.localeCompare(classname2); | ||
| } else { | ||
| if (rule1.startsWith('@') && !rule2.startsWith('@')) { | ||
| if (rule1.startsWith('@') && rule2.startsWith('@')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to affect the sorting of other at-rules like @keyframes or similar. Let's limit this to media queries first (@media)
…imit breakpoint sorting to @media rules only.
…verify that the sorting order is correct
mellyeliu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some more tests with different min-width, max-width, with px and other units so we can test the logic
| :root, .xbiwvf9{--small-x19twipt:2px;--medium-xypjos2:4px;--large-x1ec7iuc:8px;} | ||
| @media (prefers-color-scheme: dark){:root, .xsg933n{--colorTokens-xkxfyv:lightblue;}} | ||
| @media (min-width: 600px){:root, .xsg933n{--marginTokens-x8nt2k2:20px;}} | ||
| @media (prefers-color-scheme: dark){:root, .xsg933n{--colorTokens-xkxfyv:lightblue;}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally we don't have these change relative to other queries so we introduce less breaking change
| <div id="test" className="color-x1e2nbdu" data-style-src="npm-package:../../../../../../../../../js/node_modules/npm-package/dist/components/Foo.react.js:4">Hello World</div> | ||
| <div className="test" className="color-x1e2nbdu" data-style-src="npm-package:../../../../../../../../../js/node_modules/npm-package/dist/components/Foo.react.js:4" id="test">Hello World</div> | ||
| <div id="test" className="color-x1e2nbdu" data-style-src="npm-package:../../../../../../../../../js/node_modules/npm-package/dist/components/Foo.react.js:4" className="test">Hello World</div> | ||
| <div id="test" className="color-x1e2nbdu" data-style-src="npm-package:../../../../../../../js/node_modules/npm-package/dist/components/Foo.react.js:4">Hello World</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebase and yarn install and rerun the tests, this should be fixed.
What changed / motivation ?
Linked PR/Issues
Better media query sorting #1407
Additional Context
Ran and updated tests.
Pre-flight checklist
Contribution Guidelines