So, here's the thing. I have some dynamic Blade components that should accept color as a prop or fallback to default. The problem is that Blade recognizes this and compiles HTML correctly, however, Tailwind is not picking this up and is not compiling these classes so I don't see the end result.
Important: this is not a "global" Tailwind issue or my browser cache et cetera, I checked those multiple times. Other than this, Tailwind works correctly, I use NPM watch during developments, it's all good. So the problem is when some of these classes are only coming from my dynamic components, so if I e.g. want a pink button, I will not see border-pink-600 compiled in my public/css/app.css, but if I provide red as color, I will see it because I use e.g. border-red-600, text-red-600 etc. in other places, so it gets compiled based on those.
Component:
@props(['route', 'color' => 'teal'])
<a href="{{ $route }}"
{{ $attributes
->merge(['class' => 'px-2 py-1 border rounded-md
border-'.$color.'-600 text-'.$color.'-600
hover:bg-'.$color.'-600 hover:text-gray-100'
]) }}
>{{ $slot }}</a>
Adding the component in my markup:
<x-button-link route="{{ route('posts.edit', ['post' => $post]) }}"
color="amber" class="ml-2 text-sm">Edit</x-button-link>
So my final output looks like this:
<a href="http://localhost:8080/posts/81865188-dolores-libero-ut-ipsa-repudiandae/edit" class="px-2 py-1 border rounded-md
border-amber-600 text-amber-600
hover:bg-amber-600 hover:text-gray-100 ml-2 text-sm">Edit</a>
However, I don't see my button as "amber" colored, it's grayish. Basically, classes such as border-amber-600, text-amber-600 etc. are not ending up in /public/css/app.css.
There is a very annoying workaround to this and that is to manually add these classes anywhere in my Blade, let it compile to app.css so I can see the results, however, if I only use these classes in my Blade components, the next time it compiles, it will re-compile public/css/app.css without it.
Is this a known issue and expected behavior (e.g. Tailwind does compiling before blade does, so it still sees e.g. border-$color-200) or is this a bug fix material? Alternatively, am I doing something wrong? Thanks in advance!