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

Global styles are not loaded after vercel deployment #24

Closed
mochetts opened this issue Dec 13, 2020 · 4 comments
Closed

Global styles are not loaded after vercel deployment #24

mochetts opened this issue Dec 13, 2020 · 4 comments

Comments

@mochetts
Copy link

After deploying this app with vercel, global styles are not applied.

In my local

image

In vercel

image

Here's the vercel app URL: https://mochetts-prismic-blog.vercel.app/

What I found so far is that the global and reset styles are not added to the header when running the next build command.

@mochetts
Copy link
Author

UPDATE: I fixed it by moving the global & reset styles to the DefaultLayout.

@samlfair
Copy link
Contributor

@mochetts Thanks for pointing this out.

@levimykel It looks like global styles don't always work in ~/pages/_document.js:

https://stackoverflow.com/questions/57205809/style-global-jsx-doesnt-seem-to-be-applied

Should we move the global styles to ~/layouts/index.js, as @mochetts did?

@levimykel
Copy link
Contributor

@samlfair It seems like the global styles need to be in /pages/_app.js.
https://nextjs.org/docs/basic-features/built-in-css-support#adding-a-global-stylesheet

@ristomatti
Copy link

I can confirm this after banging my head on the wall for hours yesterday with the nextjs-website example.
There's an open issue about this also: vercel/next.js#8522.

Anyway, it looks like this has already been done, so I assume this can be closed?

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

5 participants