I'm using theme for frontend application
I want to keep view files and modules in theme folder and follow this tutorial
https://www.yiiframework.com/doc/guide/2.0/en/output-theming
My theme folder is /frontend/web/themes/mytheme
If I create
/mytheme/site/index.php
and use pathMap '@frontend/views' => '@frontend/web/themes/mytheme',
when I call site/index it render the view properly and theme asset files loaded (js and css)
But if I create folder views in mytheme folder and move site folder to inside
/mytheme/views/site/index.php
and use pathMap '@frontend/views' => '@frontend/web/themes/mytheme/views',, when I call site/index it render /mytheme/views/site/index.php view but theme assets files is not loaded, just some yii assets loaded properly

And this is my theme configuration part in for this theme in frontend/config/main.php:
'view' => [
'theme' => [
'baseUrl' => '@frontend/web/themes/mytheme,
'basePath' => '@frontend/web/themes/mytheme,
'pathMap' => [
//'@frontend/views' => '@frontend/web/themes/mytheme',
'@frontend/views' => '@frontend/web/themes/mytheme/views',
'@frontend/modules' => '@frontend/web/themes/mytheme/modules',
'@frontend/components/widgets' => '@frontend/web/themes/mytheme/components/widgets',
],
],
],
Themes assets loaded
Themes assets missing
| Q | A
| ---------------- | ---
| Yii version | 2.0.14
| PHP version | 7.1
| Operating system | Windows 10
Thank you for your question.
In order for this issue tracker to be effective, it should only contain bug reports and feature requests.
We advise you to use our community driven resources:
If you are confident that there is a bug in the framework, feel free to provide information on how to reproduce it. This issue will be closed for now.
_This is an automated comment, triggered by adding the label question._
I'm going to re-open the issue.
I was testing this issue, and I can reproduce it.
To have the theme assets inside @frontend/web/themes/myTheme/ I have to set the $basePath and the $baseUrl parameters set into the frontend\assets\AppAsset.php class
@neoacevedo do you have a solution?
Manual debugging shows me that $basePath and $baseUrl properties from _yii\base\Theme_ are not being filled with the configuration set in
...
view' => [
'theme' => [
'basePath' => '@app/themes/basic',
'baseUrl' => '@web/themes/basic',
'pathMap' => [
'@app/views' => '@app/themes/basic',
],
],
],
Both properties should have _@app/themes/basic_ and _@web/themes/basic_ or its translated aliases, but instead of it, I am getting null values. I have to use an own Theme class, setting it into the theme array config, or set both properties in the frontend/backend (advanced application) AppAsset class.
Any idea about the reason?
I can't track about the null values, but I'd use className inside theme array. I will try to debug again to get a clue about the issue.
Most helpful comment
I can't track about the null values, but I'd use className inside
themearray. I will try to debug again to get a clue about the issue.