After spending a couple of days on this, I'm still struggling to get the dark mode working with Tailwind CSS in Nuxt.js. It seems like there might be an issue with the CSS setup rather than the TypeScript side, especially since I have a toggle that switches the <html></html>
class between light and dark modes.
I've been trying to follow Fayazara's work as reference, which you can check out here.
Here are my environment details:
- Windows 10 Pro
- Node 14.15.4
- NPM 6.14.10
- Nuxt.js 2.14.12
- TailwindCSS 2.0.2
Below are some snippets from my configuration files:
nuxt.config.js:
// Your nuxt config settings here
tailwind.config.js:
// Your tailwind config settings here
~/assets/css/tailwind.css:
// Your custom CSS styles here
Despite all efforts, I still see the issue persisting in elements like
<p class="bg-blue-500 dark:bg-red-500">Settings</p>
, where the color remains blue even after toggling.
You can find my entire project on GitHub. Any help or guidance would be greatly appreciated!