after my latest question about adding it in Yii2
, here is my AppAsset:
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace frontend\assets;
use yii\web\AssetBundle;
/**
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class AppAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/materialize.css',
'css/materialize.min.css',
];
public $js = [
'js/materialize.js',
'js/materialize.min.js',
];
public $depends = [
# 'yii\web\YiiAsset',
# 'yii\bootstrap\BootstrapAsset',
];
}
And this is the structure of those files i've added before.:
as you can see, i've just added css`s and js files without font and icons.
So, what should i do else?
the template is a little bit like materialize, but still i think it's has a problem, see:
if there are many things to do, please guide me to do this and let it go.
also, it was on the view:
use common\widgets\Alert;
use frontend\assets\AppAsset;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\helpers\Html;
use yii\widgets\Breadcrumbs;
AppAsset::register($this);
Cheers!
Frist uncoment the 'yii\web\YiiAsset' and second use only the min version of the css and js, and add in your app asset css 'http://fonts.googleapis.com/icon?family=Material+Icons'
And the last your nav bar need to be something like that
<nav>
<div class="nav-wrapper">
<a href="#" class="brand-logo">my company</a>
<a href="#" data-activates="mobile" class="button-collapse"><i class="material-icons">menu</i></a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="<?= Url::toRoute("site/index")?>">Home</a></li>
<li><a href="<?= Url::toRoute("site/stuff")?>">Stuffs</a></li>
</ul>
<ul class="side-nav" id="mobile">
<li><a href="<?= Url::toRoute("site/index")?>">Home</a></li>
<li><a href="<?= Url::toRoute("site/stuff")?>">Stuffs</a></li>
</ul>
</div>
</nav>
Other easy way to do this is installing materialize css theme for yii2 using composer :)