styles flickering in dev with tailwind + css modules
See original GitHub issueBug report
Describe the bug
I’m using tailwindcss with css modules and I notice that the first time the page loads, all my styles are not loaded. Trying to figure it put what was happening, I run the tailwindcss example and added a style from a css module and it happens there too, even when built for prod.
To Reproduce
Run the example from https://github.com/zeit/next.js/tree/canary/examples/with-tailwindcss
Add a index.module.css
file with some style
add the styles form the css module in the index.js
page
Expected behavior
Without the use of the css modules, all styles are loaded fine the first time, without flickering. Same behavior is expected using css modules
Screenshots
System information
- OS: macOS
- Browser (if applies) [e.g. chrome, safari]
- Version of Next.js: v9.3.6
- Version of Node.js: v13.12.0
- Version of tailwindcss: v1.4.4
Issue Analytics
- State:
- Created 3 years ago
- Reactions:14
- Comments:14 (4 by maintainers)
Top Results From Across the Web
Nextjs css flickering - Stack Overflow
The solution was to create a custom pages/_document.js page with: import React from 'react'; // Modules import Document, { Html, Head, Main, ...
Read more >Using Material UI with Next.js 13 and Tailwind CSS (Part 2)
The flickering is the result of the sequence of CSS applied to the button. ... the styles from Tailwind CSS over those from...
Read more >How to make a flicker-free dark theme toggle with Next.js ...
Today, we're going to add a dark/light theme toggle to a Next.js application using TailwindCSS with no theme flickering at all.
Read more >Page blinking when using tailwindcss - GoRails
I am trying to use tailwindcss on a 5.2 ruby on rails application with webpack. Everything is set up and works well according...
Read more >[Solved]-Nextjs css flickering-Reactjs - appsloveworld
The solution was to create a custom pages/_document.js page with: import React from 'react'; // Modules import Document, { Html, Head, Main, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is a workaround to resolve this problem Create a custom “
_document.js
” and add the class “no-fouc
” in the Html component Create a custom “_app.js
” and add the following code in the “componentDidMount
”Add add this styles in the global styles:
This should be fixed in
next@^9.4.5-canary.15
! Please upgrade and let us know.