primefaces / primevue-tailwind

PrimeVue Components Styled with Tailwind CSS
https://tailwind.primevue.org
MIT License
627 stars 76 forks source link

Unable to purge unused classes in Tailwind CSS after upgrading to version 4.1.1-rc.1 #337

Closed didoin closed 1 month ago

didoin commented 1 month ago

Starting from version 4.1.1-rc.1, with the move from pass-through attributes to the use of preprocessors, it is no longer possible to properly purge unused classes via Tailwindcss in Vite.

This change is due to the fact that Tailwind CSS searches for classes used within the class attributes of the various components.

Currently, however, you declare classes using the cx() helper, which prevents Tailwind CSS from identifying which classes are actually used.

Is there a workaround to fix this problem?

In previous versions, with styles defined in pass-through, classes were identified correctly.

didoin commented 1 month ago

Honestly, I struggle to see the benefits of switching to using preprocessors.

DISADVANTAGES:

cagataycivici commented 1 month ago

The new approach does not support auto purge unfortunately as TW cannot know which class is used.

For now you need to manually choose which components you want from the set like commenting out the import line or removing the file.

Pass through still can be used, both are still supported, update is not mandatory, we'll just maintain this version.

In my computed, it takes less than a second to see the change.

From our side advantages > disadvantages, mainly the maintenance work. As I've mentioned, you can choose the one you prefer. PrimeVue is not a Tailwind CSS component library, but it can be styled with Tailwind CSS.

didoin commented 1 month ago

Thanks for your reply. So the presets will no longer be updated?

johannes-at-w commented 1 month ago

@cagataycivici could you share what will happen with the Tailwind CSS Presets? I see they're still on the roadmap.