react-daisyui
react-daisyui copied to clipboard
Using safelist /./ is too slow
Tailwind is too slow with such a safelist pattern (advised on README.md), if I remove it I go from 2s compilation time to 300ms, and I have a 12 core processor (although I'm not sure if this is multi-threaded).
Any idea why this happens, and if we should simply add an exhaustive whitelist for daisy ?
Hi @Igosuki,
You're right, it's definitely not optimal and we should reevaluate that. Can you try removing the safelist, and instead add "node_modules/daisyui/dist/**/*.js"
to your content? I'm curious to see how the compilation time compares.
Using content lookup has even better perf than safelists it seems (about 15%)
I got some missing css when change to content: ['node_modules/daisyui/dist/**/*.js']
. For example, "p-2" class from dropdown content is missing.
Is this specifc case or is there something else? Sorry if issue not related.
You should also add node_modules/react-daisyui/dist/**/*.*js
to content
of the TailwindCSS configuration
// tailwind.config.js
module.exports = {
content: [
"node_modules/daisyui/dist/**/*.js",
"node_modules/react-daisyui/dist/**/*.*js",
...
],
...
};
EDIT: But for some conditional classes it doesn't work (like tooltip position classes)
You should also add
node_modules/react-daisyui/dist/**/*.*js
tocontent
of the TailwindCSS configuration
This solved the issue. It didn't occur to me that react components of daisyui uses some additional classes compared to css ones.
I should add that if you are using a workspace with yarn 3, with a directory structure for instance of root/myapp
you need to add ../node_modules instead of simply node_modules.