A
A
Arthur2018-12-11 07:29:46
Yii
Arthur, 2018-12-11 07:29:46

How to force in Yii2 to substitute an absolute path when connecting an AssetBundle?

Greetings!
There is a bundle connection on the page, the page will be embedded into others using an Ajax request, so you need to specify the path with the domain.

class AppAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = 'http://example.com/@web';
    public $css = [
        //'css/site.css',
    ];
    public $js = [
    ];
    public $depends = [
        'yii\web\YiiAsset',
        'yii\bootstrap\BootstrapAsset',
    ];
}

Such attempts lead nowhere.
Tell me, how can I force Yuii to connect Assets to an absolute path?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Bay, 2018-12-11
@kawabanga

Specify with two slashes at the beginning.
public $css = [
'//site.com'
];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question