4

I removed yiisoft/yii2-bootstrap from composer.json and update composer, removed bootstrap from assets/AppAsset.php, but still loads bootstrap CSS and JS! When I remove <?php $this->head() ?> from layout, CSS doesn't load, but bootstrap.js is loaded!

How to remove all bootstrap assets from Yii2 basic app?

rob006
  • 18,710
  • 5
  • 41
  • 58
Masoud92m
  • 542
  • 6
  • 20
  • Are you're using some widgets/packages which depends on bootstrap? Show content of your `composer.json`. – rob006 May 21 '18 at 08:51
  • I remember to install and try a basic app template from github with bootstrap already striped away but can't find it anymore – Alex Oct 05 '18 at 07:59

1 Answers1

3

In web.php add this code

'assetManager' => [
    'bundles' => [
        'yii\web\JqueryAsset' => [
            'js'=>[]
        ],
        'yii\bootstrap\BootstrapPluginAsset' => [
            'js'=>[]
        ],
        'yii\bootstrap\BootstrapAsset' => [
            'css' => [],
        ],

    ],
],

and remove this line in AppAsset.php

public $depends = [
   'yii\web\YiiAsset',              #REMOVE
   'yii\bootstrap\BootstrapAsset',  #REMOVE
];
Masoud Zarjani
  • 415
  • 1
  • 6
  • 16
  • you can add `sourcePath=>null` in `bundles` to make sure they don't look into the `@bower` directory to load the scripts, removing the lines from `AppAsset` is not compulsory for disabling bootstrap js and css loading – Reborn May 21 '18 at 17:50