Skip to content
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

Add styles to HEAD, not to BODY #2499

Open
illialaz opened this issue Mar 26, 2024 · 4 comments
Open

Add styles to HEAD, not to BODY #2499

illialaz opened this issue Mar 26, 2024 · 4 comments

Comments

@illialaz
Copy link

Hello. I want to ask, if there any ability to add all the <style> tags in head, but not in body. In my case, we use NextJS with config { amp: true }, but it requires all the styles to store inside head tag. In this case we can't run the app. As well, the standards (HTML 4.01: the style element) clearly specifies that the style tag is only allowed inside the head tag. Could you add an ability to insert style inside head? It will be really helpful for us.

@lachlanjc
Copy link
Member

Hmm. Not sure how amp changes it but all the Next.js sites I've made with Theme UI/Emotion have <style> tags only in the <head> (see my personal site). I don't think anything about Theme UI changes this; Emotion is handling that part of the CSS rendering. Maybe check through their docs/issues? emotion-js/emotion#2037

@illialaz
Copy link
Author

Thank you, @lachlanjc
In my case I use NextJS 13.5.3, ThemeUI 0.15.3 and I run next build with output standalone
I add ThemeUIProvider in _app.tsx
My site is vention
And in my .next/server/pages/... I see that styles are added in

@illialaz
Copy link
Author

Well, you won't see that in the site the styles are in body. They are somehow moved to head. But when I check .next/server/pages/....html I see that styles are in body. And amp sends me error for these html files

@illialaz
Copy link
Author

Screenshot 2024-04-11 at 18 58 48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants