-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Production build returns multiple styles #1370
Comments
Hi. Please make sure to follow the issue template, it will help us to help you. |
I'm facing the exact same issue. I'd like just one |
Has anyone looked into this? We have the same problem. We’re developing a big page in Next.js and Emotion is injecting 11 style tags for global styles and 191 style tags for other styles in production builds. Of course the style tags are spread out in the DOM and moved to Can we somehow disable inline style tags and just inject the styles ourselves during SSR? |
@baldurh yes, you can use old SSR API as described here https://emotion.sh/docs/ssr |
@Andarist thanks! OK so does that then not inject inline |
I believe so, u can check out tests to verify |
@Andarist I’ve managed to get it working. Thanks! One weird thing however, it seems the styles from react-select are somehow slipping by the extraction 🤷♂ |
You'd have to share a runnable repro case so I could take a look at this. If you create such then please just create a new issue about this. Other than that I consider this issue as resolved. Multiple style tags are expected, unless you are using "old" SSR APIs. |
Would it not be possible to look into combining Emotion styles into (preferably) a single The large number of individual |
I guess it makes sense that the default behavior just works and it does that by injecting the style tags where the styles are used. You could try our approach using the style extraction. It has been working well for us |
@baldurh baldurh How did you get it working ? Could you append a codesnippe or point me to the right direction ? |
I really want create a seperate css file, don't like css in html. :( it can make site slow down (1% i think XD)... |
Current behavior:
I use Emotion with "@emotion/babel-preset-css-prop". In production environment Emotion creates multiple style tags. This is desired for the dev environment, but not for production.
To reproduce:
Given the component above my head looks as following:
I read all issues regarding to Emotion, but I couldn't find something similiar.
Expected behavior:
Emotion should render one single stylesheet file.
Environment information:
react
version: 16.8.6emotion
version: ["@emotion/core": "^10.0.10",
"@emotion/styled": "^10.0.4",
"@emotion/babel-preset-css-prop": "^10.0.9"
]
The text was updated successfully, but these errors were encountered: