Order of loaded assets not according asset files

For using the Tooltip function of bootstrap v3.4.1 with YII2.0.18 the order of the loaded javascripts must be changed. I can’t fix it.

After upgrading to YII2.0.18 the order of the loaded javascripts is changed. Formerly scripts where loaded in this order:

  • jquery-ui.js
  • bridge.js
  • bootstrap.js

Now it is as follows:

  • bootstrap.js
  • jquery-ui.js
  • bridge.js

Due to this change the bridge.js script can’t rewrite the tooltip functionname of the JqueryUI script before the bootstrap.js is loaded.

I use the following command in the bridge.js:

$.widget.bridge(‘uitooltip’, $.ui.tooltip);

The AppAsset file:

class AppAsset extends AssetBundle
{
public $basePath = ‘@webroot’;
public $baseUrl = ‘@web’;
public $css = [
‘css/main.css’,
https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css’,
‘css/multi-select.css’,
];
public $js = [
‘js/main.js’,
‘js/invoiceLines.js’,
‘js/rememberTabs.js’,
‘js/jquery.multi-select.js’
];
public $depends = [
‘yii\web\YiiAsset’,
‘app\assets\BridgeAsset’,
‘yii\bootstrap\BootstrapAsset’,
‘yii\bootstrap\BootstrapPluginAsset’,
];
}

And the BridgeAsset file

class BridgeAsset extends AssetBundle
{
public $basePath = ‘@webroot’;
public $baseUrl = ‘@web’;

public $js = [
    'js/bridge.js'
];
public $depends = [
    'yii\web\JqueryAsset',
    'yii\jui\JuiAsset',
];

}

I can’t get changed the order of the loaded scripts unless I experimented with dependencies in the assetfiles.

Finally found the answer, in web.php i added the following under assetManager:

‘bundles’ => [
‘yii\bootstrap\BootstrapAsset’ => [
‘depends’ => [
‘yii\jui\JuiAsset’,
],
],
],

This makes the JqueryUI depending of the bootstrap assets.