TailwindCSS in Livewire components used in Filament Pages
I have added a custom Livewire component that I'm using in a Filament page.
It's working well but I can't seem to get any of my tailwindd classes to do anything. I have installed tailwind and set it up according to the docks.
In the rendered code I see my tailwind class but it doesn't appear that it knows what it is. Is there anything else I need to do to get things working?
Not sure if this is a Filament or a Livewire issue or something else entirely. New to both.
Thanks for any help!
34 Replies
Did you include your app views in the tailwind config.?
I think filament:theme doesn’t include them by default when it generates the scaffolding.
I did make a tailwind.config.js and made it look like this. You can see various things I've tried.
Looks ok to me.
Also, this may be due to NativePHP problems? I'm working on trying this on my filament website to see if it's locally related
This is the blade component
in my app.css I have this
And the
.doesThisWork
in fact, does not work.
So that seems like a problemFilament isn’t loading app.css
Unless you told it too.
Did you use filament:theme to set it up or did you do it from scratch?
oh..
I did it from scratch which I think I'm now regretting
😅
Let me try the theme thing, forgot about that. doh
brb
And if I do the theme, I shouldn't need to install tailwind, autoprefixer, et al myself right?
Nor setup my own tailwind.config.js in the root of the project?
It should do all that for you.
great. giving that a try
It will create a tailwind config for you in the css directory
@elationk is my partner in crime for this NativePHP in Windows so we're starting to rough out some apps using Filament
Then you just need to add it to Vite and your panel. But the theme script will give instructions.
Love it.
Right. I should have known this from helping test that theme problem my first night in the discord. Working to undo all the manual setup first
Only thing I usually add is “tailwindcss/nesting” to the post css config so I can write custom css in a better syntax.
jesus I hate windows at times
file_put_contents(C:\Repos\PHP\Laravel\werd\postcss.config.js): Failed to open stream: Permission denied
Of course
get it? it's herd but for windows. so it's
werd
😉Lol
Nerd 🤓
^-- my wife when I talk about my programming problems lol
the theme creation command failed half way through because of windows file permissions <a:skull_laugh:1054043407468724224>
reverting that to try again
and I run it again and it
Sudo all the things.
Yea, sudo'ing from a powershell. Nice joke
powershell sucksssss
Project Idea #5222662 of mine: Replace powershell with zsh.
Zsh is killer. Started using warp myself. Not sure they have it for windows. It’s really good though.
WSL cp zsh powershell
I’m just make shit up now. Lol.
Flip that. Lol
Yea, I could always go from the other side, use terminal (aka WSL) to run windows stuff from 'linux' via ZSH. But then half the time that doesn't work for an assortment of reasons.
No doubt.
Hmm, let me try this on the site version that is fully in WSL (debian)
My problem, is half the time, I don't know if it's a me problem, Livewire problem, or Filament since I am brand spanking new to both Livewire and Filament at the same time.
Used warp to ssh into a box today and it still maintained all of it text select shortcuts etc and directory look a heads despite the box not having support for any of it. I was impressed.
pretty impressive
That all looks like permission issues.
Eating dinner real quick. brb
'./resources/views/livewire/**/*.blade.php',
Needed to be added to my custom theme's tailwind.config.js
's content
section.
and oh man, I had accidentally made a postcss.config.js
but made it as a directory instead of a file and the empty dir didn't show up in my git diff so I missed it.. got it working on my filament 'site' but still not working in NativePHP. troubleshooting continues just broke the styles of the whole app lol
So I know we're off in the weeds here, but I have
->viteTheme('resources/css/filament/admin/theme.css')
in my panel provider, it breaks the styles of the whole app,
if I remove it, everything looks normal but none of my tailwind classes in my livewire components nor filament pages take effect with it missing. For posterity, I had to make a postcss.config.js file as well in my root dir