Tailwind classes still missing in filament-page's custom view
Hi, when adding a filament-page with custom view in
/resources/views/filament/admin/pages/custom-page.blade.php
, shouldnt tailwind with this config make sure to include classes that are used in the view blade (because of ./resources/views/**/*.blade.php
rule?
Because this doesnt seem to work, I'm still missing the classes and only have filament's builtins available..29 Replies
Did you rerun the build after adding everything to your custom page blade? And is your custom page blade using filament's page component?
If you mean
npm run build
then yes, and yes 😄
/resources/views/filament/admin/pages/custom-page.blade.php
/reservations/app/Filament/Admin/Pages/CustomPage.php
bg-gray-400
works, bg-black
does notLooks fine to me
Maybe some cache thing?
could be
Any commands for refreshing it? I dont suppose
cache:clear
takes care of that 😄since it's a stylesheet i'd think it'd be browser cache, but
optimize:clear
is good too.Nope, stil nothing :/ not even browser change
working fine for me
well... fuck 😄
same tailwind config file?
essentially.
only difference is i'm targeting
./resources/views/filament/**/*.blade.php
specifically because I have two stylesheets, one for filament and one for frontend.yeah, pretty much the same
I've been stuck on this for like 2-3 hours by now
maybe an
npm update
?still nothing
did you generate the theme with the command line?
just wondering why your tailwind.config.js is at the root of the app
wondering if you're preset path is right, is what i'm getting at
would think that would throw an error though if it couldn't find it to import
nope, I just installed the full panel builder and then ran
php artisan make:filament-panel admin
so you're not using a custom theme?
nope
well there's your problem.
So if I get rid of the separated Admin panel and use just the "default panel", it will work as intended?
no, you just have to use a theme if you want to do any custom styling
each panel could have it's own thme
so no need to change the panel
you just need to add the generated stylesheet for your custom theme to the vite manifest and the ->viteTheme('path/to/theme.css') to the panel
basically what you are doing is createing a whole new stylesheet and telling Filament not to use it's own stylesheet
Okay, got it.. just the fact that I have to create separate theme when I want to use classes that are not in filament by default seems a bit odd
it is not a "theme" per se, I just want to be able to use all available tailwind classes in a
filament-page
unfortunately, that's just not how tailwind works, it has to purge out unused classes. otherwise the css file would be 10MB. 🙂
Yeah, I understand that, but then why doesnt the the root tailwind.config.js take over and search for files that should be in the built css file? The blade file for the filament-page is in resources/views folder, so why doesnt tailwind go for it?
it can pick it up and build all day long. but you still have to tell Filament to use a different css file
Filament can't magically pick it up
I thought it gets mixed into one bundled css file with the same name that would just contain a few more classes 😄
Sorry if im asking obvious questions btw
Filament has a stylesheet that is prebuilt and ships with filament and gets loaded by the panel by default. So, there's no way to add custom styles to it. Therefore, you have to compile you're own version of that stylesheet with your additional tailwind classes. Then tell the panel to ignore it's default stylesheet and load your version.
Ahh, I think i got it..
I'm reading the docs page over and over.. but I feel like it is saying "Hey, themes are something that you can use to override default filament styles", which is awesome, but in addition to this, I feel like it should say something like "Custom theme is required in order to use tailwind classes that are not built into filament itself".. It doesnt need to be in the same section, but if it is already in the docs somewhere, I definitely missed it 😄
But thank you!! 3 hours not wasted after all ❤️