-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix issue where dark mode experiment won't work if user has plugins array in config #2322
Conversation
@adamwathan I'm guessing this is Tailwind UI's fault, but including the UI plugin kills the |
…lugin due to this issue: tailwindlabs/tailwindcss#2322
@brandonpittman I ran into the same issue. I can’t easily give up the Tailwind UI plugin right now because I’m relying on too many classes generated by it to simply remove it. That being said, I found this comment to be useful. Instead of using the experimental dark mode support that (as of 0.8.3 for me) still breaks, this is working as expected and should be easy enough to adapt to a class if needed: module.exports = {
// ...
theme: {
screens: {
// ...
"dark": {
"raw": "(prefers-color-scheme: dark)",
},
},
},
// ...
} |
@codex-zaydek I wound up requiring Tailwind UI and just grabbed the boxShadow and color bits I needed. |
@codex-zaydek What error are you seeing when trying to enable dark mode with the Tailwind UI plugin? This builds no problem for me: module.exports = {
purge: ['./index.html'],
future: 'all',
experimental: 'all',
plugins: [require('@tailwindcss/ui')],
} |
@adamwathan Hey Adam. It wasn’t an error; was missing classes. Try this config: module.exports = {
dark: "media",
experimental: {
darkModeVariant: true,
},
plugins: [
require("@tailwindcss/ui"),
],
} This curiously generated no I’m on Edit: I created this Gist to help you debug: https://gist.github.com/codex-zaydek/1538a0b6d34db7f8556b58a24b8c2b7b. Includes the raw output for reference. Based on the presence of |
⬆️ Just as I said. The big issue is that there is no way to extend variants like you can with a theme. You have to just overwrite them. I’m guessing the PR from yesterday might actually solve this issue? |
Yep yep yep I understand now, thanks! Will try to push out a fix today, will require a new version of the Tailwind UI plugin. |
Awesome — thanks! 🔥 |
@adamwathan This config seems to fix it: module.exports = {
dark: "class",
experimental: {
darkModeVariant: true,
},
plugins: [
require("@tailwindcss/ui"),
],
variants: {
// https://github.com/tailwindlabs/tailwindcss/releases#dark-mode-experimental
backgroundColor: ({ after }) => after(["dark"]),
borderColor: ({ after }) => after(["dark"]),
divideColor: ({ after }) => after(["dark"]),
gradientColorStops: ({ after }) => after(["dark"]),
placeholderColor: ({ after }) => after(["dark"]),
textColor: ({ after }) => after(["dark"]),
},
}
|
Can you guys test out @tailwindcss/ui@0.6.0 and see if it works for you? Should solve this problem, but it's only compatible with Tailwind v1.8+. |
Sure. Will test this now! Thank you. |
Hey @adamwathan, still broken for my use-case. This is an improvement but it’s not working 100% as expected. Here is the essence of my working config: module.exports = {
dark: "class",
experimental: {
darkModeVariant: true,
},
plugins: [
require("@tailwindcss/ui"),
],
variants: {
opacity: ({ after }) => after(["group-hover", "group-focus"]),
scale: ({ after }) => after(["group-hover", "group-focus"]),
textColor: ({ after }) => after(["group-hover", "group-focus"]),
},
} And my code basically looks like this: .dark .dark\:group:hover .dark .dark\:group-hover\:text-purple-50 {
--text-opacity: 1;
color: #f6f5ff;
color: rgba(246, 245, 255, var(--text-opacity));
} It looks like this almost works but the presence of the second Let me know if I’m doing something wrong as well. |
Ah this is actually a straight up bug, looks like the dark mode stuff does not play nicely with the |
You bet. Feel free to follow-up with me for testing with a real-world app. 👍 |
@adamwathan @codex-zaydek The @tailwindcss/ui update fixed the issue and the new variant extension feature solved the issue I had with variants and tailwindcss-plugin-fancy! 🌶 |
Fixes #2319.