bootstrap.css Is Not Loading

Here is my code:


<?php

    use yii\bootstrap\Alert;

    

    echo Alert::widget([

        'options' => ['class' => 'alert-success'],

        'body' => 'message...',

    ]);

?>

This displays fine on the page but the bootstrap.css file is not loaded (not present in the HTML) and thus the alert does not present correctly.

Here is my AppAssets.php file:


<?php

namespace frontend\assets;


use yii\web\AssetBundle;


class AppAsset extends AssetBundle {

    public $basePath = '@webroot';

    public $baseUrl = '@web';

    public $css = [

        'css/site.css',

    ];

    public $js = [

    ];

    public $depends = [

        'yii\web\YiiAsset',

        'yii\bootstrap\BootstrapAsset',

    ];

}

Any ideas why it is not loading?

found a solution for this? i’m having the same issues. it only loads on some views

namespace frontend\assets;

use yii\web\AssetBundle;

/**

 * Main frontend application asset bundle.

 */

    class AppAsset extends AssetBundle

    {

        public $basePath = '@webroot';

        public $baseUrl = '@web';

        public $css = [

           'css/site.css',

        ];

        public $js = [

        ];

        public $depends = [

            'yii\web\YiiAsset',

            'yii\bootstrap4\BootstrapAsset',

             // here we add our FontAwesomeAsset bundle class

            'frontend\assets\FontAwesomeAsset'

        ];

    }

Do you have some configuration for this in your frontend/config/main.php (config/web.php for app-basic)?

Check for the assetManager attribute.