I've installed the yii2-bootstrap4 extension in yii2-advanced and I've added a customized css file (custom.css
) re-compiling Bootstrap source with Sass.
Then I've added custom.css
to frontend/web/css
and I've modified frontend/assets/AppAsset.php
as follows:
class AppAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/custom.css',
'css/site.css',
];
public $js = [
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap4\BootstrapAsset',
];
}
I obtained the result I wanted, but I noticed that the <head>...</head>
of my pages contains the following:
<link href="/yii2-advanced/frontend/web/assets/1758a11a/css/bootstrap.css" rel="stylesheet">
<link href="/yii2-advanced/frontend/web/css/custom.css" rel="stylesheet">
<link href="/yii2-advanced/frontend/web/css/site.css" rel="stylesheet"></head>
And:
[...]/css/bootstrap.css
contains the original Bootstrap 4 css- if I delete that first entry from the DOM (via Devtools) the web pages are not affected.
Questions
- Is this the correct way to replace the Bootstrap 4 css file in Yii2?
- Is there a way to prevent the loading of
[...]/css/bootstrap.css
?