Bagisto Forum

    Bagisto

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

    Theme Development

    General Discussion
    2
    2
    1140
    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.
    • W
      wadim last edited by

      Hello,

      I’ve created a new theme for our Bagisto shop. Everything works fine so far. The only thing that bothers me is that every time I adjust the views, I have to run the following commands to apply the changes:

      npm run build
      php artisan vendor:publish –tag=km-theme-views –force
      php artisan cache:clear
      

      This is quite annoying in the long run. Is it possible to adjust the theme so that only the NPM build needs to be executed and the changes are applied automatically?

      Thanks! 🙂

      V 1 Reply Last reply Reply Quote 0
      • V
        vaibahv_bagisto @wadim last edited by

        @wadim
        You shouldn't need to run vendor:publish or php artisan cache:clear every time you modify your theme's Blade views.

        The most likely reason is that your theme is loading views from the published directory instead of directly from your package source. Check the views_path for your theme in config/themes.php. If it points to the published location (for example, resources/themes/...), update it to point to your package's source views directory instead, such as:

        'views_path' => 'packages/Km/Theme/src/Resources/views',
        

        Once the theme is loading views directly from the package source, changes to .blade.php files are picked up automatically by Laravel. You should only need to refresh your browser, as Blade recompiles templates when the source files change.

        For frontend assets (CSS and JavaScript), use:

        npm run dev
        

        during development instead of repeatedly running npm run build. The Vite development server watches for changes and reloads assets automatically.

        If you ever need to clear compiled Blade templates manually, use:

        php artisan view:clear
        

        rather than clearing the entire application cache.

        Development workflow

        • Blade (.blade.php) changes: Refresh the browser.
        • CSS/JS changes: Keep npm run dev running.
        • vendor:publish: Only needed when initially publishing package resources or when you intentionally want to update the published copies, not for everyday view development.
        1 Reply Last reply Reply Quote 0
        • First post
          Last post