CDN dark mode Next.js #16138
leon-plackal
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I recently ran into an issue when trying to use the Tailwind CDN in a Next.js app. Specifically, it was unclear how to allow
darkMode: 'class'
for dark mode functionality while using the CDN when using the documented inline script method. It seemed to be unsuccessful specifically with Next.js.I know this is a pretty niche case where you want all classes to be available dynamically after build, however here is a solution that worked for me in my Next.js app:
So I thought it might help to share. You would add this in a layout.js file where you want all classes to be available. Tested in
3.4.1
Beta Was this translation helpful? Give feedback.
All reactions