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
Upgrade to Stylis 3 #829
Upgrade to Stylis 3 #829
Conversation
@thysultan I'm seeing some weird |
Generated by 🚫 dangerJS |
@thysultan some duplication in ssr.test: -/* sc-component-id:sc-global-2303210225 */
-body{ background:papayawhip; }
+/* sc-component-id: sc-global-2358157387 */
+{ ; }
+body{ background:papayawhip}
+body{ background:papayawhip}
+body{ background:papayawhip}
+body{ background:papayawhip} |
This is by design, V3 adds semicolons where omitted to support no-semicolons, so
This looks like a bug, whats the full input? |
@philpl patched some of theses in 3.0.1, BTW the cascade option should be true(default), false turns of cascading. Do you know what is passed to stylis in this case body{ background:papayawhip}
body{ background:papayawhip}
body{ background:papayawhip} Edit: found the bug |
Managed to patch it... Where do these empty blocks |
Those are on purpose, they are per-component rather than the others, which are per-instance-of-css-fragment 😊 |
I was trying to track down where and how they are passed to stylis, since stylis removes empty blocks its a bit odd that they would appear, if they are getting passed through it. |
Most failed tests now are whitespace related... Is there a way to have the tests break up on a failed test to mitigate having to view all the failed tests at once. |
Hiya, I'll finish this PR this evening :) yea, you can use jest's file filter with the P key |
@thysultan found another bug... I think: - .sc-a{ } .c{ color: blue; } .c > h1{ font-size: 4rem; } .sc-b{ } .d{ color: blue; } .d > h1{ font-size: 4rem; } .d{ color: red; }
+ .sc-a{ } .c{ color: blue; } .c > h1{ font-size: 4rem; } .sc-b{ } .d{ color: blue; color: red; } .d > h1{ font-size: 4rem; } Source: const Parent = styled.div`color: blue;`
const Child = Parent.extend`color: red;` It seems to be combining the two Edit: btw that's the last outstanding question/regression/issue/dunno Edit 2: Ok, correct me afterwards if I'm wrong—tired at this point—but my abysmal knowledge of CSS specificity tells me that this is indeed a correct merge |
Hmm, is the red in the above expected or what v3 is putting out. Because I think it's more correct. |
Depends on what exactly is in that test case. Could you post a link to the source? |
@geelen it's merging the two rules that have the same selectors in the correct order. So (see Edit2) i think it's correct. |
It's by design, it now behaves like it would in sass/postcss we where talking about this before here #286. I decided it's better to have parity with scss to avoid unexpected results, i.e nested BTW, is there any reason for this stringifyRules.js#L23-L25 const cssStr = (selector && prefix) ?
`${prefix} ${selector} { ${flatCSS} }` : // here
flatCSS
// and
.replace(/^\s*\/\/.*$/gm, '') // replace JS comments |
@thysultan yea, these lines are for several cases that need to line up with the preprocessing: On the normal side: https://github.com/styled-components/styled-components/blob/master/src/constructors/keyframes.js#L19 On the preprocessing side we then use it like this: https://github.com/styled-components/styled-components/blob/master/src/no-parser/stringifyRules.js#L13 It's all stuff that will be cleaned up with v3, since the entire preprocessing logic and the way we'll use stylis will change then :) (as discussed prior) |
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.
Alright this looks good to me
@philpl don't you get this error? Maybe it's because I'm using
|
@brunolemos Oh, I didn't get that error in any test. Weird. Seems to be fixed now and we'll just need to update the yarn lockfile on release |
No description provided.