I have the following asset bundle and i would like to add jQuery UI as part of it as well. How can I do it?
<?php
namespace app\assets;
use yii\web\AssetBundle;
class AdminAsset extends AssetBundle
{
public $basePath = '@webroot/assets-admin';
public $baseUrl = '@web/assets-admin';
public $css = [
'css/common.css',
'css/animations.css',
'css/editor.css',
'css/form.css',
'css/fileupload.css',
'css/template.css',
'css/icons.css',
];
public $js = [
'js/libs/modernizr.js',
'js/script.js'
];
public $depends = [
'yii\web\JqueryAsset',
'yii\web\YiiAsset',
];
}
At first install official JUI Extension for Yii 2.
Then add yii\jui\JuiAsset
to list of dependent assets:
public $depends = [
'yii\jui\JuiAsset',
...
];
yii\web\JqueryAsset
in this case is not required because JuiAsset
already has it in dependencies list so it will be included as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With