F
Filament3mo ago
dyo

problem in css after upgrading to v4

can someone please help me? I just upgraded filament to v4, the problem is now the filament style doesn't seems to be working. I've run npm run build, and no issues there, and ran artisan optimize:clear, still no luck. I don't have viteTheme in AdminPanelProvider. What am I missing?
No description
Solution:
yes I did.. finally the css is working again after I added these, inside <head> at my base blade file.. @filamentStyles @vite('resources/css/app.css')...
Jump to solution
18 Replies
LeandroFerreira
LeandroFerreira3mo ago
weird. Try php artisan filament:assets Console errors?
dyo
dyoOP3mo ago
yeah, i've run those too.. and this is the status from css file in network tab
No description
LeandroFerreira
LeandroFerreira3mo ago
did you clear the browser cache?
dyo
dyoOP3mo ago
yes I did, and i've tried hard reload and open in incognito
OswaldoCFR
OswaldoCFR3mo ago
you created resources/css/filament/panel/theme.css and you have vite.config.js: import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; import tailwindcss from '@tailwindcss/vite'; export default defineConfig({ plugins: [ laravel({ input: ['resources/css/app.css', 'resources/js/app.js', 'resources/css/filament/panel/theme.css'], refresh: true, }), tailwindcss(), ], }); ??
pratik
pratik3mo ago
same problem here, I have no custom theme and my styling broke for the whole panel.
OswaldoCFR
OswaldoCFR3mo ago
Well, you must create one and run Vite
Povilas Korop
Povilas Korop3mo ago
In Filament 4, you almost always NEED custom theme for any CSS styling. Here's my 4-minute video about it: https://www.youtube.com/watch?v=sTYkRuUhjsQ
pratik
pratik3mo ago
Yep, yep, yep, this was the missing thing in the document, Like maybe I should send a pr to add the line : You are going to need custom theme if you have any custom filament page or view that has tailwind css used.
dyo
dyoOP3mo ago
sadly, i've follow the docs to create a custom theme, and no erros after running npm run build, but the result is still the same..
Povilas Korop
Povilas Korop3mo ago
@dyo there should be no errors, "css styles not applied" wouldn't show as an error in browser console or anywhere. So yes it's hard to debug but also it's hard/impossible to say what exactly did you do wrong in your process of following the docs. Have you watched my video?
Solution
dyo
dyo3mo ago
yes I did.. finally the css is working again after I added these, inside <head> at my base blade file.. @filamentStyles @vite('resources/css/app.css')
Povilas Korop
Povilas Korop3mo ago
oh so you had a BASE blade file? Yeah, you didn't explain those details so that's why all we could give you is general recommendations. Anyway, glad it's solved!
dyo
dyoOP3mo ago
thanks for the answer though.. 👍 I'm a fan of your youtube channels..
Dennis Koch
Dennis Koch3mo ago
This looks pretty similar too the Filament default layout. Why did you overwrite this? Or are you not using the Panel?
dyo
dyoOP3mo ago
Yes i'm using the Panel, I still not figured it out why I must do that.. This project is developed in a team..
Dennis Koch
Dennis Koch3mo ago
You shouldn't overwrite the base.blade.php file. Because every time something changes in Filament, that file will be outdated and that might break stuff.
dyo
dyoOP3mo ago
thanks for the warning.. noted..

Did you find this page helpful?