I am facing an issue. I have custom Module in which i am trying to load CSS and JS by AppAsset but its not loading.
In my Module i have layouts folder in which i am trying to access the appasset and registering the view but its not loading. Even the asset bundle shows that assests are being loaded
Tell me what i am doing wrong. The code is as follows
namespace app\assets;
use yii\web\AssetBundle;
class AppAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/site.css',
'css/bootstrap-reset.css',
'css/style.css',
'css/style-responsive.css',
];
public $js = [
'js/jquery.js',
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
];
}
my view file is as follows
<?php
use yii\helpers\Html;
use app\assets\AppAsset;
AppAsset::register($this);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="ThemeBucket">
<link rel="shortcut icon" href="images/favicon.png">
<?php $this->registerCsrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?>
<!--Core CSS -->
</head>
<body class="login-body">
<?php $this->beginBody() ?>
<?php $this->endBody() ?>
</body>
</html>
But the css is not loaded at all and i cant see any of the css which i defined in Asset Bundle
Function <?php $this->head() ?>
just adds a placeholder where all head meta tags, styles, scripts must be placed.
When <?php $this->endPage() ?>
is called it replaces placeholder with registered meta tags, styles, scripts, etc.