Bagisto Forum

    Bagisto

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

    Loading custom.css depending on the active theme

    Knowledge Base
    3
    4
    554
    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

      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

        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
        • P
          phillip last edited by

          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

            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
            • First post
              Last post