Currently, I am immersed in a Livewire project and attempting to implement some Tailwind theme configurations. However, the process does not appear to be coherent whatsoever. Here is an excerpt of my Tailwind configuration:
theme: {
extend: {
fontFamily: {
sans: ['Figtree', ...defaultTheme.fontFamily.sans],
},
colors: {
'blue': {
light: '#bae6fd',
DEFAULT: '#38bdf8',
dark: '#0369a1'
},
'red': '#be123c'
}
},
}
Subsequently, comes the button component
@props(['color' => 'gray'])
@php
$classes = 'bg-' . $color . ' hover:bg-' . $color . '-dark inline-flex items-center
px-3 py-2 border-transparent rounded-md font-semibold text-xs text-white
uppercase tracking-widest focus:outline-none focus:ring-2 focus:ring-
indigo-500 focus:ring-offset-2 transition ease-in-out duration-150'
@endphp
<button {{ $attributes->merge([
'type' => 'submit',
'class' => $classes
]) }}>
{{ $slot }}
</button>
The button is utilized like this
<x-button color="blue">{{ __('Edit') }}</x-button>
And here's what unfolds:
- execute
npm run build
: white background, style classes fail to apply. - re-run
npm run build
: style properties recognized and function as desired. - run it again: ceases to function, background turns white with no hover effect.
- modify button's color attribute to red and execute
npm run build
: somewhat functional but lacks hover effect. - switch back to blue and execute command: failure, complete disregard for blue theme colors.
- switch to red and run command: successful .....
- eventually even red stops working, making it challenging to anticipate its behavior.
The situation seems unreliable, potentially stemming from an erroneous approach on my part, anticipating it to mirror a frontend JavaScript framework's performance.
Any guidance and insights are greatly welcomed.