-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
[next] Wrap all generated CSS with a cascade layer (WIP) #226
Conversation
We have visual regression tests running with Pigment on the Material UI repo, we can create a draft PR pointing to these builds to check if anything unexpected is happening there. It probably won't cover all edge cases but it would be helpful.
Why do you consider this to be a quick fix? If it is a quick fix, can users implement it on their side? We could propose it as a workaround until we agree on a definitive solution.
If it is, let's try to fix it on our side anyway. We can open an issue on their repo and refactor it later, but let's not block a fix on our side. |
Would this cover it? Seems to pass.
Because it's just rewriting the css without considering the source maps. This means that the links in devtools will be off by one line. It may be quite a bit more involved to write this in a way that sourcemaps are transformed as well. It all comes down to how much effort we want to pour down into fixing this. For now it's probably good enough as a fix.
I don't think so, this is just a bug on our side. |
I am not sure how fool proof the fix is and if wouldn't cascade into some other bug. |
What do you mean with "globalCss api"? I've tested by adding a If this is not the fix, we're going to have to brainstorm 😄. Next.js recommends cascade layers as a way to get around this issue. |
@@ -284,6 +283,19 @@ export const plugin = createUnplugin<PigmentOptions, true>((options) => { | |||
} | |||
|
|||
let { cssText } = result; | |||
|
|||
const slug = slugify(cssText); |
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.
Can you move the whole thing at the end of the if (isNext)
check at line https://github.com/mui/pigment-css/blob/master/packages/pigment-css-unplugin/src/index.ts#L301
since we mainly want to do this for next.js and not webpack (unless someone reports it for webpack as well).
We'll have to see if someone reports any new issues. It fixes the current bug.
Sourcemaps are working without any issues since the linkage is through the generated class names which we are not touching.
Not really since wyw does not have any nextjs specific solution. If it had |
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.
Thanks for the fix.
One way to fix #199
Notes:
wyw-in-js
?Closes mui/material-ui#43705