saadeghi / daisyui

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

docs: SvelteKit Example Issue with tailwind.config.cjs #3207

Closed mkmoisen closed 3 weeks ago

mkmoisen commented 2 months ago

On which page do you see this issue?

https://stackblitz.com/edit/daisyui-sveltekit?file=tailwind.config.cjs

Describe the issue

The SvelteKit example uses the following tailwind.config.cjs file:

module.exports = {
  content: ['./src/routes/**/*.{svelte,js,ts}'],
  plugins: [require('daisyui')],
};

I believe this should be changed to:

module.exports = {
  content: ['./src/**/*.{svelte,js,ts}'],
  plugins: [require('daisyui')],
};

It is common in svelte to have a directory structure like:

/src/
    /lib/
        /components
    /routes/
        +page.svelte

Where components are placed outside of /src/routes/.

If you mindlessly follow the example like I do, the DaisyUI CSS will not work when you run npm run build.

Interestingly, it seems to work pretty much OK when you run npm run dev, although it is kind of hit or miss. Sometimes the styles get applied, and other times they do not.

Replacing with ['./src/**/*.{svelte,js,ts}'], fixes both of these issues.

What browsers are you seeing the problem on?

All browsers

github-actions[bot] commented 2 months ago

Thank you @mkmoisen for reporting issues. It helps daisyUI a lot ๐Ÿ’š
I'll be working on issues one by one. I will help with this one as soon as a I find a solution.
In the meantime providing more details and reproduction links would be helpful.