• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Register
  • Login
Bagisto Forum

Bagisto

  • Register
  • Login
  • Search
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups

Loading custom.css depending on the active theme

Knowledge Base
3
4
553
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P
    phillip last edited by 29 Oct 2019, 09:37

    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

    1 Reply Last reply Reply Quote 0
    • R
      rahul last edited by 30 Oct 2019, 08:10

      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

      1 Reply Last reply Reply Quote 0
      • 7 days later
      • P
        phillip last edited by 6 Nov 2019, 11:02

        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'
        
        1 Reply Last reply Reply Quote 0
        • N
          Naresh-webkul last edited by 6 Nov 2019, 14:30

          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

          1 Reply Last reply Reply Quote 0
          4 out of 4
          • First post
            4/4
            Last post