primefaces / primevue-tailwind

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

PrimeVue/Lara Tailwind styles not applied when using themes w/ Laravel setup #80

Closed fylzero closed 7 months ago

fylzero commented 7 months ago

I'm setting up a project using Laravel v10 (w/ Vite/Laravel Breeze) and when I use the Lara preset + root styles + tailwind color extensions, styles for things like Buttons that rely on the "surface" color sets are not being rendered. I assume because of JIT removing the styles that aren't being used directly in Vue templates.

Steps to reproduce:

import Button from "primevue/button";

...
<template>
    <Button label="Secondary" severity="secondary" />
</template>

Result: Button styles are applied except for the colors that call out surface.

I'm struggling to figure out a solution that doesn't involve adding each iteration of the class into a template. Though I would imagine it might be possible to have tailwind.config.js need an additional place to scan for used classes in JIT:

export default {
    content: [
        "./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php",
        "./storage/framework/views/*.php",
        "./resources/views/**/*.blade.php",
        "./resources/js/**/*.vue",
    ],

Any ideas how to solve this?

Update: Also noticed this happening for simpler classes like bottom-[20px] and right-[20px] when using things like the ScrollTop component.

fylzero commented 7 months ago

Figured it out, it just wasn't scanning the js files.

"./resources/js/**/*.{vue,js}",