Custom Theme in Separate Package
-
Hi there
I am trying to determine if Bagisto suits my needs for an urgent project.
So far things are looking okay, however I am struggling to work out how to create a custom theme that is able to be kept within its own package (I do not want to be editing files in too many places outside of this package for the theme as I want to be able to easily reuse it in other projects).
How do I go about setting up the views_path etc. in themes.php to point to views within a specific package (e.g. ACME/CustomTheme)?
Secondly, is there any "minimalist" theme out there I can look at? Even the default theme has a lot of extra stuff in it I don't need and whilst I can of course start with that and remove what I don't want it would be nice to have something that is the absolute minimum for a working "shop".
Thanks -
Hi @porl,
There is no minimalist theme right now. For theme creation, you need to take the exact file structure of the shop package.
Just start with the views directory of the shop package.
-
Hi @devansh-webkul
Thanks for that. I have a package with a mirrored views directory from the shop package, but how to I reference it from the themes.php file? -
Hi again
Never mind, I found the solution.
For anyone else with the same issue I needed the full path (relative to the root Bagisto directory).eg:
'views_path' => 'packages/ACME/CustomTheme/src/Resources/views/shop', 'assets_path' => 'packages/ACME/CustomTheme/src/Resources/assets',
Not sure if there is a cleaner way to do this but it works at least.
-
Hi @porl,
Exactly, you need to give the path in the
themes.php
file and change the default view. -
Hi there! @porl @devansh-webkul @developerus Is it possible to do this better by utilizing
php artisan vendor:publish
and selecting the appropriate custom package to publish? My team is trying to do something similar, but are running into the same issue and the relative path solution seems suspect to me. There has to be a better way.
-
Hi @lukasyelle,
It depends on development, if someone only wants to do the CSS stuff then this command is not needed because use can directly do in the resources folder.
However, if you totally want to change the package and make theme from scratch. Then you can create a new package and use that command which you are telling by registering your assets in the provider.
-
Thank you @devansh-webkul