Preventing a specific CSS file from getting loaded in Yii2

I need to stop loading bootstrap.css file in one view to void duplicate. But I don’t know how to do that in Yii2.

I used this function in Yii 1:





Yii::app()->clientScript->scriptMap = array(     'main.css' => false );

Do we have like this function in yii2 ?

Do not use widgets that using bootstrap

I found solution:

If you need to disable the CSS specific to core bootstrap in a view then add the following on top of your view file like this


Yii::$app->assetManager->bundles['yii\bootstrap\BootstrapAsset'] = false;

and if you need to disable the bootstrap core js sources also then use


Yii::$app->assetManager->bundles['yii\bootstrap\BootstrapPluginAsset'] = false;

 https://stackoverflow.com/questions/48973327/preventing-a-specific-css-file-from-getting-loaded-in-yii2?noredirect=1#comment84963244_48973327

Thank YOU!!!

bootstrap.css was loading on a page it shouldn’t but only on first page load! On page refresh it would disappear! I could not find where it was loading from! I tried for hours! Thanks!!!