Z
Z
ZaurK2019-06-20 22:44:35
Yii
ZaurK, 2019-06-20 22:44:35

How to include bootstrap only in a module?

Hello! In the yii2 basic application, the admin panel is located in the admin module. In the frontend, I don't want to use the bootstrap and jQuery built into yii2, so I disabled them via config/web:

'assetManager' => [
       'bundles' => [
           'dmstr\web\AdminLteAsset' => [
               'skin' => 'skin-blue',
           ],
           'yii\web\JqueryAsset' => [
            'js'=>[]
           ],
           'yii\bootstrap\BootstrapPluginAsset' => [
            'js'=>[]
           ],
           'yii\bootstrap\BootstrapAsset' => [
            'css' => [],
           ],
       ],
   ],

As a result, of course, they are disabled in the admin module, so the admin panel suffers. Can you please tell me how to make sure that the built-in bootstrap and jQuery are disabled only in the frontend, and they are enabled in the module?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2019-06-20
@slo_nik

Goodnight.
In the module file, in the init() method

public function init()
     {
         parent::init();
         Yii::$app->view->setAssetManager(new AssetManager());
     }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question