I’m having trouble with something that should be straightforward. I’m attempting to register an asset bundle in my view and for the life of me I can’t get the thing to work. Here is the code for the asset bundle:
namespace frontend\assets;
use yii\web\AssetBundle;
class LoginAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'login/plugins/font-awesome/css/font-awesome.min.css',
'login/css/style-metro.css',
'login/css/style.css',
'login/css/style-responsive.css',
'login/css/themes/default.css',
'login/plugins/uniform/css/uniform.default.css',
'login/plugins/select2/select2_metro.css',
'login/css/pages/login-soft.css',
];
public $js = [
'login/plugins/jquery-migrate-1.2.1.min.js',
'login/plugins/jquery-ui/jquery-ui-1.10.1.custom.min.js',
'login/plugins/bootstrap-hover-dropdown/twitter-bootstrap-hover-dropdown.min.js',
'login/plugins/excanvas.min.js',
'login/plugins/respond.min.js',
'login/plugins/jquery-slimscroll/jquery.slimscroll.min.js',
'login/plugins/jquery.blockui.min.js',
'login/plugins/jquery.cookie.min.js',
'login/plugins/uniform/jquery.uniform.min.js',
'login/plugins/select2/select2.min.js',
'login/plugins/jquery-validation/dist/jquery.validate.min.js',
'login/plugins/backstretch/jquery.backstretch.min.js',
'login/scripts/app.js',
'login/scripts/login-soft.js',
'js/login.js',
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
'yii\bootstrap\BootstrapPluginAsset',
'yii\web\JqueryAsset',
];
}
And here is the snippet of the view where I’m using it:
use frontend\assets\LoginAsset;
use yii\widgets\Breadcrumbs;
/* @var $this \yii\web\View */
/* @var $content string */
LoginAsset::register($this);
And her is the directory structure where the assets are located:
frontend–>web —>login
all of the assets are in this folder and subfolders
And I’m not getting any errors – just none of the assets are being registered. Any idea what I’m doing wrong?
Thanks!