Yii2 advanced template, PHP 5.6, Ubuntu 16.04, nginx.
I have following myproject/backend/assets/AppAsset.php:
class AppAsset extends AssetBundle {
public $basePath = '@webroot';
public $css = [
'/css/style.css',
'/plugins/iCheck/square/blue.css',
'/plugins/datatables/dataTables.bootstrap.css',
'/css/AdminLTE.min.css'
];
public $js = [
'admin/js/common.js',
'plugins/datatables/jquery.dataTables.js',
'plugins/datatables/dataTables.bootstrap.js',
'plugins/iCheck/icheck.min.js'
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset'
];
}
Layout has:
use backend\assets\AppAsset;
AppAsset::register($this);
It is my layout main.php, when I have added AppAsset bundle.
<?php
use backend\assets\AppAsset;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
AppAsset::register($this);
/* @var $this \yii\web\View */
/* @var $content string */
?>
<?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() ?>
<?php
//$assets_base = Yii::$app->controller->getAssetsBase();
?>
<title>MyProject</title>
<?php $this->head() ?>
</head>
<body class="login-page">
<?php $this->beginBody() ?>
<h1>Test!!!</h1>
<?= $content ?>
<?php $this->endBody() ?>
</body>
</html>
<?php
All css and js files are located in public folder web (myproject/backend/web).
When I reload page tag <head> has only:
<meta charset="UTF-8">
<meta name="viewport"
<meta name="csrf-param"
<meta name="csrf-token"
main.php)?