tailwind purge of (daisy-generated) classes #3367
Replies: 5 comments 5 replies
-
lime, amber, etc are Tailwind CSS colors, not daisyUI colors. I think you're talking about Tailwind CSS prefix, not daisyUI prefix And having all colors in the production is not expected behavior. You should have I'm guessing the |
Beta Was this translation helpful? Give feedback.
-
Here's my tailwind.config.js:
Now, the daisy config:
It seems clear to me that the tailwind purge may well be working correctly. However, the "root" cause might be that the "lime-" colours already appear in the I have the feeling that my issue may not be in the daisy.css generation per se, but in my configuration of |
Beta Was this translation helpful? Give feedback.
-
Based on your comments, I will go back to the drawing board -- back to first principle -- and see if I can work out exactly what is happening. You did not comment re. the use of the "prefix" option. In the above "daisy configuration", where should the "prefix" go? straight under the |
Beta Was this translation helpful? Give feedback.
-
ok... here's a very cut-down version -- bear with me re. a few bits and pieces left (from the original): test_tailwind.html:
tailwind.config.js:
tailwind_daisy.config.js:
webpack.common.js:
and... lastly, here's the build output:
Bottom Line (round 1) -- the Essentially, all looking good -- no "lime-", no "amber-". That said, as you'll notice, I have the |
Beta Was this translation helpful? Give feedback.
-
Otherwise... back to my original problem of picking up all sorts of colors that aren't in use by me... That has been resolved. Except... please don't ask as to how -- as I simply don't know! I went back and started from "blank" configurations both tailwind, daisy and our own css (with imported npm modules) etc., followed the tailwind, daisy, webpack instructions -- all of which I thought I had done previously -- and all looks in shape now. All good. Lastly, big thanks for your quick response(s), saadeghi. Much appreciated. |
Beta Was this translation helpful? Give feedback.
-
Hi All,
I have been using tailwindcss and daisyUI successfully for a couple of years now. All good on use and ease of development.
However, I am finally finding time to look at bundling -- webpack -- and the resulting size of the the CSS artifact. Unfortunately, it appears to be an "interplay" across the tailwind / daisyUI / webpack boundaries -- and issues are hard to trace.
Here's a loose description of symptoms I am seeing -- I am looking for ideas and suggestions.
I have defined tailwind to use only a very limited set of colors: white, black and red. The remainder of colour palettes are configured as part of daisy themes -- using explicit hex/rgb values.
But what I am seeing -- when daisy.css is generated (using a daisy-prefix of "dui-"), I am ending up with classes for the full tailwind colour palette! For example: "dui-border-lime-100" (through to 'dui-border-lime-800'), "dui-bg-lime-..." etc. etc. for colours such as "amber", "indigo" etc. When, in fact, I don't use lime, amber of indigo in any of my themes.
That might be acceptable...
But, then, when tailwind is meant to purge said "unused" classes -- it simply does not seem to work. And the resulting .css contains the full set of limes and ambers.
Of course, and I didn't explicitly mention this, all of my other classes, customisations, themes, etc. work just fine. It is just that I am ending up with an very oversized css artifact. And colours may not be the only unused bits and pieces -- just the obvious ones.
Thoughts? Comments? Much appreciated.
--olaf
Beta Was this translation helpful? Give feedback.
All reactions