Missing css files while including `yii\bootstrap5\BootstrapPluginAsset`
insthync opened this issue · 4 comments
insthync commented
What steps will reproduce the problem?
Set $depends
in AppAsset
to
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap5\BootstrapPluginAsset'
]
What is the expected result?
Having bootstrap css files in assets
folder
What do you get instead?
No css files
Additional info
Q | A |
---|---|
Yii vesion | 2.0.45 |
PHP version | 8.1.12 |
Operating system | Windows 10 |
insthync commented
I've temporarily avoided this issue by following instructions in https://github.com/yiisoft/yii2-bootstrap5/blob/master/docs/guide/assets-setup.md -> Using CDN section
By add
'assetManager' => [
// override bundles to use CDN :
'bundles' => [
'yii\bootstrap5\BootstrapAsset' => [
'sourcePath' => null,
'baseUrl' => 'https://cdn.jsdelivr.net/npm/bootstrap@5.1/dist/',
'css' => [
'css/bootstrap.min.css'
],
],
'yii\bootstrap5\BootstrapPluginAsset' => [
'sourcePath' => null,
'baseUrl' => 'https://cdn.jsdelivr.net/npm/bootstrap@5.1/dist/',
'css' => [
'css/bootstrap.min.css'
],
'js' => [
'js/bootstrap.bundle.min.js'
],
],
],
],
to config/web.php
(in components
)
xhostch commented
Seems to be related to #9741, ran into the same issue just the other way around (js files not present).
You can also override the publishOptions
in the application config to work around this:
'assetManager' => [
'bundles' => [
'yii\bootstrap5\BootstrapAsset' => [
'publishOptions' => ['only' => ['dist/js/bootstrap.bundle.*', 'dist/css/bootstrap.*']],
],
'yii\bootstrap5\BootstrapPluginAsset' => [
'publishOptions' => ['only' => ['dist/js/bootstrap.bundle.*', 'dist/css/bootstrap.*']],
],
],
],
julianrutten commented
This is caused by #52. Best solution for now is to pin your dependency to version 2.0.3
simialbi commented
I think it's caused by the only
clauses. Rolled back this change