-
Notifications
You must be signed in to change notification settings - Fork 262
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
Fix nested style tags break compilation #260
Conversation
@rauchg should we instead throw an error when we detect nested |
I think we should support this since scoped |
I don't think ignoring is the right solution. Throwing an error until we fully support it would be ideal |
Any news on this PR? It's been a while since last activity :) |
7612a07
to
f7e7fb5
Compare
Hi, first of all thanks for the great product! I just lost a couple hours of work (and I'm on a tight schedule) because Next.js threw up with a cryptic error when I made a simple nested style. I'd been searching the web for more than 1 hour when I finally understood (from several issues/bug reports) that styled-jsx does not allow this kind of nesting. It was frustrating to learn that, instead of throwing early and clearly, the team decided to simply ignore invalid code.
It seems obvious to me that compilation should not succeed when there is invalid code. Could someone explain the rationale behind this? Maybe no one thought that users might be confused, was that the case? In case there's no good explanation, maybe this decision could be reversed, so styled-jsx would throw with a clear message (as per @rauchg's comment)? Also, nowhere in the docs I couldn't find that we weren't supposed to do such nesting. Maybe that needs fixing too? I'll leave some details below for people that might run into the same problem as I did. Error:
pages/test.js:
I was able to solve it with
|
iirc we don't allow nested style tags like:
With this PR we ignore them because otherwise compilation breaks when there is one.