igaster/laravel-theme

assetPath and viewsPath for themes that not set asset-path and views-path in theme.json

Closed this issue · 1 comments

I think its better to inherit assetPath and viewsPath from theme config in themes.php when there is no asset-path and views-path params in theme.json. In consturction of Theme class you just use

        $this->assetPath = $assetPath === null ? $themeName : $assetPath;
        $this->viewsPath = $viewsPath === null ? $themeName : $viewsPath;

and if change to

        $this->assetPath = $assetPath === null ? config('themes.asset_path') . $themeName : $assetPath;
        $this->viewsPath = $viewsPath === null ? config('themes.themes_path') . $themeName : $viewsPath;

when we use url() function, it'll find the file in our theme folder, not from the public folder, and there is no need to set the asets path and views path in theme.json file

Actually theme.json files are optionaly. You can move all your settings in the config\themes.php file and remove json files. However if you create a theme.json file then it should have all the information needed in order for theme packaging commands to work properly.

The purpose of config\themes.php is actually to overwrite project-wide the default theme-options that where shiped with a theme (maybe by a third party) without touching the theme itself.