Replies: 3 comments
-
if you could use laravel-vite more cleanly please share your experience in this discussion |
Beta Was this translation helpful? Give feedback.
-
Your last suggestion worked for me to get a custom theme working. Thank you! The grammar thing through me off at first since you said "If you won't use your custom theme", I think you meant "If you want to use your custom theme". Hoping for an official solution eventually so we don't have to rely on a hook, but great idea. 💯 |
Beta Was this translation helpful? Give feedback.
-
ok in the latest version of filament we have official vite support for theming : for more details just check the documentation: |
Beta Was this translation helpful? Give feedback.
-
as you might know, laravel migrated from laravel-mix to laravel-vite, and from now on it will use vitejs with laravel-vite as the main frontend asset builder.
in laravel-vite, unlike the laravel-mix, we don't have access to the asset's URLs directly. and @Vite directive will inject specified scripts or styles + some vite scripts for hot reloading in the dev environment.
if you want to add custom assets to the filament admin you can use this workaround :
or you can use render hooks :
if you won't use your custom theme you can use this code :
since we don't have access to the CSS asset we should pass the empty URL to the
registerTheme
so the filament doesn't load default filament CSS assets.then we inject the custom-themed CSS file using filament render hook to the end of the head tag so other custom themes from plugins don't overwrite our theme.
Beta Was this translation helpful? Give feedback.
All reactions