Theme Development
-
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:clearThis 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!

-
@wadim
You shouldn't need to runvendor:publishorphp artisan cache:clearevery 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_pathfor your theme inconfig/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.phpfiles 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 devduring 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:clearrather than clearing the entire application cache.
Development workflow
- Blade (
.blade.php) changes: Refresh the browser. - CSS/JS changes: Keep
npm run devrunning. vendor:publish: Only needed when initially publishing package resources or when you intentionally want to update the published copies, not for everyday view development.
- Blade (