您好
打开/backend/views/layouts/main.php 你会看到如下内容:
<?php
/* @var $this \yii\web\View */
/* @var $content string */
use backend\assets\AppAsset;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use common\widgets\Alert;
AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<div class="wrap">
注册css和js是 类 backend\assets\AppAsset 这个asset类完成的,那么,打开这个类
<?php
namespace backend\assets;
use yii\web\AssetBundle;
/**
* Main backend application asset bundle.
*/
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',
];
}
你如果想去掉 'css/site.css' ,这个css ,直接去掉就可以了。
当然,可能也在于依赖的assets里面。譬如是
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset'
里面的某一个,这个是Yii的,你可以新建一个Assets,然后重写里面的方法,把想去掉的去掉,然后$depends
里面填写你重写的Assets即可。