Open hyquoccuong opened 5 years ago
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.
What steps will reproduce the problem?
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 properlyAnd this is my theme configuration part in for this theme in frontend/config/main.php:
What is the expected result?
Themes assets loaded
What do you get instead?
Themes assets missing
Additional info