0

I need to stop loading the 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
);
1

1 Answer 1

1

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;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.