How to use daisyui using standalone tailwindcss.exe ? #2721
-
Pardon for possibly asking a simple question. I am not familiar with Nodejs. I don't use Nodejs at all. I am using a different site generator which is a simple standalone SSG (see fillpouch.com ) I downloaded the standalone tailwindcss.exe on windows and I created this input.css
And I gave this command:
The above does produces styles.css and the site looks fine. But at the front of style.css it has copied that "@import url("https://cdn.jsdelivr.net/npm/daisyui@4.5.0/dist/full.min.css");" which I think means, the browser will download the entire minimized DaisyUI css (It will later cache it , possibly, on other calls of the HTML) | My question is: Is there a better way to compress and optimize this? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
The minified file is compressed, but the challenge is, it includes all the class names, even the ones you don't use. If you use daisyUI and Tailwind CSS as Node dependencies, it will only export the required class names but with standalone file, it's not possible because Tailwind CSS standalone file only supports first-party plugins, not third party plugins like daisyUI. So one way would be (hopefully) finding a tool that removes the unused styles in your environment. Let me know if you have any questions |
Beta Was this translation helpful? Give feedback.
-
Thank you so much. That was quite helpful. So does this mean that if I use this import(@....) method I am not really getting any advantage of using tailwindcss.exe build process? Should I anyway resign myself to directly using the daisyui minimized CSS and the js file as suggested on the daisyui website. I know it is not recommended, but if tailwindcss.exe is not really reducing anything, I might as well remove the extra step of generating styles.css |
Beta Was this translation helpful? Give feedback.
-
This build of the standalone CLI includes support for DaisyUI without using npm https://github.com/dobicinaitis/tailwind-cli-extra |
Beta Was this translation helpful? Give feedback.
The minified file is compressed, but the challenge is, it includes all the class names, even the ones you don't use.
Shipping unused CSS is not optimal for production.
If you use daisyUI and Tailwind CSS as Node dependencies, it will only export the required class names but with standalone file, it's not possible because Tailwind CSS standalone file only supports first-party plugins, not third party plugins like daisyUI.
So one way would be (hopefully) finding a tool that removes the unused styles in your environment.
Another way would be using Node and using daisyUI as a Tailwind plugin so you only get the required class names and use the output CSS file (made by Node) in your app.
Let m…