Configuring AssetBundle - all absolute CSS/JS links

Hi,

I am trying to figure out, how can I configure AssetBundle via /config/main.php.

The reason is, that we need to use globally absolute links for all assets (CSS + JS bundles) instead of relative.

We have set absolute @web alias:


Yii::setAlias('@webabs', empty($_SERVER['SERVER_NAME']) ? '/' : '//'.$_SERVER['SERVER_NAME']);

So the only thing we need to change is the property baseUrl in class \yii\web\AssetBundle:


baseUrl = '@webabs'

Following did not work for me:


'assetBundle' => [

    'baseUrl' => '@webabs',

],

because "assetBundle" is not core component.


'yii\web\AssetBundle' => [

    'class' => 'yii\web\AssetBundle',

    'baseUrl' => '@webabs',

],

because Object configurator will not configure property.

Does anyone have any clue?

Thanx in advance.

Lubos

Solution would be:


'components' => [

    // ...

    'assetManager' => [

        'baseUrl' => '@webabs/assets'

    ],

],