Search code examples
cssyii2

Disable loading default side.css in Yii2


I'm starting a new project with Yii2 based on the default example-Welcome-to-yii page. In this example-project, the css file from web/css/site.css is loaded.

But looking in index.php views/layout/main.php, views/site/index.php an the related controller/action, I can't find the place, where the site.css is registered. So how to remove the registration in order to remove that file?


Solution

  • The site.css registration is in yourapplication\asset\AppAsset.php

    see this

        class AppAsset extends AssetBundle
        {
            public $basePath = '@webroot';
            public $baseUrl = '@web';
            public $css = [
                'css/site.css',
            ];
            public $js = [
            ];
            public $depends = [
                'yii\web\YiiAsset',
                'yii\bootstrap\BootstrapAsset',
            ];
        }