igaster / laravel-theme

Theme support for Laravel
MIT License
521 stars 113 forks source link

All themes in public/themes #95

Open blissgrn opened 6 years ago

blissgrn commented 6 years ago

Hi,

I'd like more information about this topic : https://github.com/igaster/laravel-theme/issues/38 Indeed, I'd like to have all my themes under public/themes folder Is it possible to configure something like this :

// VIEWS 'themes_path' => null, // ASSETS 'assets_path' => 'themes'

Instead of having to configure the path for each themes: 'themes' => [ 'main' => ['asset-path' => 'themes/main'], 'example1' => ['asset-path' => 'themes/example1'], 'example2' => ['asset-path' => 'themes/example2'], ];

Thank you :)

sergejostir commented 4 years ago

I would also find this very useful, since I would like to make my asset path relative to public/themes and not to /public as it is now by default.

blissgrn commented 4 years ago

Hi @sergiz

It's been a while and not sure I remember everything but if it can help you, here what I finaly did.

In each theme.json : { "name": "my-custom-theme-1", "extends": "my-parent-theme", "asset-path": "themes/my-custom-theme-1" }

I believe I did not change anything in the config/themes.php, which I found more convenient.

'themes_path' => null, [...] 'themes' => [],

Cheers.

igaster commented 4 years ago

@blissgrn unfortunately you can only configure the location for the views, but not for the assets. You are right that you can achieve a similar result by placing a json file inside the theme (views) folder

sergejostir commented 4 years ago

@blissgrn That's what I want to avoid (and I guess you did too, considering your original post). Currently there is no way to implicity have asset path set to something else than public/, so you have to define it manually for every theme. With a new configuration option that you proposed, we could avoid that (and avoid even having to make theme.json for every theme).

igaster commented 4 years ago

theme.json is optional. You can just use the config/themes.php file to configure your themes. (This is IMO a better approach)

The json file was developed as a feature to make the themes portable between applications with no external configuration dependencies

igaster commented 4 years ago

I will not close this issue, because I think that it could be a good feature to add in the future

sergejostir commented 4 years ago

I know theme.json is optional, but if you don't want your themes assets building up in public/, then in it is de facto not optional anymore since you cannot globally define for all assets to be in for example public/themes/.

It is a pretty minor change to add default assets path configuration option (like we have for views), but it would make things much nicer (I guess I'm not the only one that likes to keep theme assets in a subdirectory, not directly in public/).

oasin commented 4 years ago

Is there an update regarding this?

szwss commented 4 months ago

Me too, same issue