yii2

How to add Bootstrap 4 to Yii2?

If you’ll ever tried to install Twitter Bootstrap 4 Extension for Yii 2 you know that this is pain in the ass because Bootstrap 3 dependency…

Let’s fix this mess by editing composer.json.

Step 1

Change minimum-stability to dev:

"minimum-stability": "dev",

Type composer update in a console.

Step 2

After update add Bootstrap 4 dependency:

"require": {
  …
  "yiisoft/yii2-bootstrap4": "~1.0.0",
  …
},

Once again type composer update.

If you want to always load Bootstrap 4

Open assets/AppAsset.php and change depends section like this:

    
public $depends = [
  'yii\web\YiiAsset',
  'yii\bootstrap4\BootstrapAsset',
];

Znalezione obrazy dla zapytania french aristocrat

et voilà tout!

Published by

Konrad Fedorczyk

Konrad Fedorczyk

I'm interested in programming and gamedev. I especially luv HTML5 and everything connected to web technologies.

Leave a Reply

Your email address will not be published. Required fields are marked *