Loading custom.css depending on the active theme
-
Hello, I was reading the documentation but couldn't find a solution. I want to load a custom.css depending on the active theme. I have the same structure like in the documentation. Inside the master.blade.php I'm trying to access the css like this:
{{ themes()->current()->assetsPath }}/css/shop.css
which gives me the following output: http://localhost/public/themes/my_custom_theme/assets/css/shop.css , I also tried without /public/ but it throws a 404 error. What would be the correct path? Or is there a better way to accomplish this? Thanks in advance
-
hello @phillip
You don't need to access your css file like this in master blade.
While theme creation, We define its css and view files, so when application gets start then according to theme, it will load css ans view files.
The css file will be automatically changed according to theme.
Thanks
-
You are right, I keep loading my custom css like so:
<link rel="stylesheet" href="{{ bagisto_asset('css/shop.css') }}">
This loads my custom css just how I want it, but the parent styles from Bagisto itself are fully lost after doing this. Inside theme.php I specified the default theme as parent. Is this the intended behaviour?
'parent' => 'default'
-
Hello @phillip ,
Yes this is intended behaviour and because of you override the shop.css with your custom css file , that's why the parent css is not applying to shop .
thank you