saadeghi / daisyui

๐ŸŒผ ๐ŸŒผ ๐ŸŒผ ๐ŸŒผ ๐ŸŒผ โ€ƒThe most popular, free and open-source Tailwind CSS component library
https://daisyui.com
MIT License
33.41k stars 1.27k forks source link

Colors not applied correctly using WindiCSS. (Svelte, Vite, WindiCSS) #17

Closed atresnjo closed 3 years ago

atresnjo commented 3 years ago

Hey, I'm trying to set up a new project using Svelte with Vite as build tool and WindiCSS.

btn-primary doesn't seem to work, butbg/text-primary seems to work fine.

I have uploaded a repo showcasing the issue. https://github.com/atresnjo/svelte-vite-daisyui-windicss

Here's what the output looks like image

Thanks again for your great work so far, loving your slick design! ๐Ÿฅ‡

saadeghi commented 3 years ago

@atresnjo Hi.
I think currently using Daisy on WindiCSS is experimental. It looks like WindiCSS is ignoring --tw-bg-opacity and --tw-text-opacity variables from Tailwind.
I know on Tailwind, when we use a color like bg-blue-500 or any other color, it adds --tw-bg-opacity: 1 to that element as well as the background color but WindiCSS seems to work differently.

@marshallswain Can you please help us here?

marshallswain commented 3 years ago

It's definitely a problem with the --tw-bg-opacity and --tw-text-opacity variables. I just made a minimal example with Vue and found the following style in the browser. Notice how the two variables only have a single - prefix. If I edit the style in the Svelte project or my new mini Vue project, it fixes the colors. I've also re-looked through my app that's working and can't identify a single thing that's different... yet.

Screen Shot 2021-03-29 at 12 38 54 PM

marshallswain commented 3 years ago

You can work around the variable issue by adding them to the :root style, like this:

Screen Shot 2021-03-29 at 1 12 30 PM

In my working app, the button groups and other components are all working without any changes. I've copied the config over from the working app into the non-working minimal app, and it's still not working. I'm not yet able to trace down the source of the missing -.

marshallswain commented 3 years ago

Uggh. I found the issue. It's a little bit embarrassing.

Screen Shot 2021-03-29 at 1 17 23 PM

@saadeghi I will work on creating a plugin just for Windi. Their transform utility is definitely not working. I must have had made a git mistake and uncommented that line while I was working on getting the colors to work.

marshallswain commented 3 years ago

@atresnjo, I recommend that you use the cdn version until I have the new plugin made. Windi's API is a bit simpler than Tailwind's, so far, so we'll see how quickly it happens.

atresnjo commented 3 years ago

Hey, thanks guys for the help! I've switched to tailwindcss-jit. Seems to work fine! Not sure yet if there are any caveats compared to WindiCSS, but so far so good.

gunters63 commented 3 years ago

I found the reason for the single dash variables, see here: Component generation not 100% compatible to TailwindUI with leading dashes