laravel-theme icon indicating copy to clipboard operation
laravel-theme copied to clipboard

refactor(Themes.php): views-path can now be defined inside theme.json

Open msamec opened this issue 8 years ago • 5 comments

Up until now views-path could only be defined inside config/themes.php, but if defined within theme.json it would be overriden with theme name. If you defined theme.json like following using theme.json instead of config/themes.php

{
    "name": "themeName",
    "extends": "",
    "views-path": "themeName/views",
    "asset-path": "theme/themeName"
}

views-path would just be overriden with themeName. This is a problem when we want to structure theme folder like so

themes
│
└───themeName
    │
    └─── assets
    └─── views

But with this change we can define view-path within theme.json too, not only config/themes.php

msamec avatar Aug 18 '17 22:08 msamec

Hello @msamec,

This was a design decision to put the theme.json inside the views-path. I was thinking that having an option to set the views-path to an other value would create some confusion. Putting the views + assets in the same subfolder would be the best structure, but that would also mean that you should move your views into the public folder!

I am possitive to add this option but I would need to run some tests first because it will break some artisan commands.... Thank you for your contribution!

igaster avatar Aug 19 '17 16:08 igaster

@igaster thank you for replying. But I didn't understand what you meant when you said views would need to be moved to public folder. Could you elaborate that a bit?

msamec avatar Aug 22 '17 12:08 msamec

Public assets should be in the public directory in order to be served be Apache or Nginx. So if you decide to have the proposed folder structure then it should be located under the public folder too!

igaster avatar Aug 22 '17 14:08 igaster

Yea, that makes sense. Because in your previous reply you said that VIEWS should be moved to public folder, but I guess you meant to say assets instead of views.

But yea, this is exactly what we are doing. We have a gulp task which goes through assets folder in theme, does his job and then creates files in appropriate folders in public folder.

msamec avatar Aug 22 '17 22:08 msamec

I attempted to use exactly the same folder structure as @msamec before I discovered the 'views-path' setting doesn't work in the theme.json file. Are there any plans to allow this setting?

Knappster avatar Feb 24 '19 18:02 Knappster