asset bundle dependency

My understanding is that if your asset depends on other assets. The asset will be loaded after. I have a MaxlengthBootstrapAsset which depends on ‘yii\web\YiiAsset’ and ‘yii\bootstrap\BootstrapAsset’

When I view page source, it shows bootstrap-maxlength.min.js is loaded between jquery.js and bootstrap.js. I thought bootstrap-maxlength.min.js should be loaded after jquery.js and bootstrap.js ??




//page source

<script src="/assets/7ce4b429/jquery.js"></script>

<script src="/assets/2707647c/yii.js"></script>

<script src="/assets/a0bb0a41/bootstrap-maxlength/bootstrap-maxlength.min.js"></script>

<script src="/assets/11f72d6b/js/bootstrap.js"></script>

<script src="/assets/2707647c/yii.gridView.js"></script>

<script src="/assets/47480d08/jquery.pjax.js"></script>

<script src="/assets/c7e9bb76/toolbar.js"></script>






namespace frontend\assets;


use yii\web\AssetBundle;


/**

 * @author Qiang Xue <qiang.xue@gmail.com>

 * @since 2.0

 */

class MaxlengthBootstrapAsset extends AssetBundle

{

    public $sourcePath = '@bower';

    public $baseUrl = '@web';

    public $js = [

        'bootstrap-maxlength/bootstrap-maxlength.min.js',

    ];

    public $depends = [

        'yii\web\YiiAsset',

        'yii\bootstrap\BootstrapAsset',

    ];

}



Try $depends with ‘yii\bootstrap\BootstrapPluginAsset’ instead of ‘yii\bootstrap\BootstrapAsset’.

awww, i realized my mistake,

yii\bootstrap\BootstrapAsset is for bootstrap css

yii\bootstrap\BootstrapPluginAsset is for bootstrap js

thanks bizley