Custom CSS in public/assets/css/custom.css Not Loading After Upgrade #1339
Replies: 3 comments 1 reply
-
|
After upgrading to the latest version of Backpack, custom CSS files registered in config/backpack/ui.php may not load as expected. This is because, starting with Backpack v6 and the introduction of themes (like theme-tabler), the theme’s config file (e.g., config/backpack/theme-tabler.php) takes precedence over ui.php for keys like styles and scripts. If a theme defines its own styles array, it will completely override the one in ui.php, and only the theme’s styles will be loaded. What you should do:
Example: // config/backpack/theme-tabler.php
'styles' => [
base_path('vendor/backpack/theme-tabler/resources/assets/css/color-adjustments.css'),
base_path('vendor/backpack/theme-tabler/resources/assets/css/colors.css'),
'assets/css/custom.css?v=' . filemtime(public_path('assets/css/custom.css')),
],Key points:
References:
If you follow these steps and add your custom CSS to the theme config, your styles should be loaded correctly. ℹ️ Please note our AI Bot does not reply to follow-ups, this will be the only AI answer in this thread. If the AI helped you find the answer, please mark it as answered or write details below so it can learn. Then close the conversation. If not, please give more information for when a human reads this. ℹ️ Relevant sources: Assets aren't loading correctly |
Beta Was this translation helpful? Give feedback.
-
|
Like i have my file custom.css and I want to use it's CSS to load in all pages of my project I have also tried it linking in my top_left_blade resources\views\vendor\backpack\theme-coreuiv4\layouts\top_left.blade.php on local it is working fine but on server it does not work previously my custom.css file was in public/packages/backpack/base/css/custom.css and in my top_left_blade CSS is applied like this @include(backpack_view('inc.head')) @php $customCss = asset('assets/css/custom.css') . '?v=' . filemtime(public_path('assets/css/custom.css')); @endphpmy previous CSS is running but if I send some new changes in custom.css it does not load on server |
Beta Was this translation helpful? Give feedback.
-
|
Hey @11aman Here are few guide to help you with this: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Backpack team 👋,
After upgrading to the latest version of Backpack, I encountered an issue where my custom CSS file is no longer loading as expected.
✅ What I did:
I’ve added a new CSS file at this path:
public/assets/css/custom.css
In my config/backpack/ui.php file, I registered it like this:
'styles' => [
'assets/css/custom.css?v=' . filemtime(public_path('assets/css/custom.css')),
// env('APP_URL').'/assets/css/custom.css',
],
The Problem:
The CSS file seems to be completely ignored — the styles defined in custom.css are not applied to any of the Backpack pages. I confirmed:
The file exists and is accessible directly via the browser (when visiting /assets/css/custom.css)
Cache has been cleared (php artisan config:clear, route:clear, etc.)
The URL with filemtime() appears correct and changes when the file is modified
I also tried using a direct URL (env('APP_URL') . '/assets/css/custom.css') with no luck
Beta Was this translation helpful? Give feedback.
All reactions