Tailwind is not working with some classes in my project
I have followed the installation steps here:
https://tailwindcss.com/docs/guides/laravel
And followed the steps over here too:
https://filamentphp.com/docs/2.x/forms/installation#configuring-styles
Here are some files that I'm using:
Install Tailwind CSS with Laravel - Tailwind CSS
Setting up Tailwind CSS in a Laravel project.
Filament
Installation - Form Builder - Filament
The elegant TALL stack form builder for Laravel artisans.
28 Replies
And this is the file that I'm trying to apply styles in and it's not working, I can't paste it because of char length
Did you compile your theme? Did you register that theme inside Filament?
I had created the Provider to register the theme but haven't included in the providers list in config/app.php, after I did, I ran
npm run build && npm run dev
and now this is the result:Did you check that the stylesheet it loaded?
It failed
Anyhelp on how to load it correctly?
this article can help you
https://filamentphp.com/blog/easy-way-to-create-a-filament-theme-in-minutes
Filament
Easy way to create a Filament Theme in minutes! by Leandro C. Ferre...
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
Thanks guys ๐ It worked out I actually was using sail and with vite and sail I had to add that extra piece of code refernced in the official Laravel documentation:
https://laravel.com/docs/10.x/vite#configuring-hmr-in-sail-on-wsl2
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. Weโve already laid the foundation โ freeing you to create without sweating the small things.
Now again sorry about that, but the theme compiles however the newly added colors are not working
This is the config and whenever I use
border-red-500
or whatever it's not displaying the correct colorWhat is "the correct color"? You defined red as red? ๐ค
What do you mean?
red: colors.red,
I want to use the red color yes
Is there something wrong? ๐
No need to define them in the theme. They should be already available
You are still running
npm rund dev
?Yes
I removed them and it's not working still
The "Full" should be in red it has text-red-500
Where are you using these colors?
Are those Actions?
Custom Form Field
text-{{ $option['color'] }}-500
Tailwind won't recognize that class if you inject a variable.Is there any reason why it recognizes them in
success
and warning
classes?success
and warning
are already used inside FilamentThis is how I'm actually using the field:
Ok I see, any suggestions? Maybe pass the whole color in the
'color'
key?Either that or use a safelist in your TW config
Based on TW docs it's discouraged
So I think I'll go with the earlier
I'll let you know whether it works or not
Safelisting looks like the better approach here since there are different weights and uses like
boreder-
and text-
, and it worked, thank you ๐
One final question ๐
is there a way on PHP side to get the current theme (AKA 'dark' or 'light')?
Basically in hintColor()
for the form field, I want the hint color to be different based on the current theme dark or lightGitHub
GitHub - def-studio/vite-livewire-plugin
Contribute to def-studio/vite-livewire-plugin development by creating an account on GitHub.