Answer the question
In order to leave comments, you need to log in
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',
];
}
Answer the question
In order to leave comments, you need to log in
Specify with two slashes at the beginning.
public $css = [
'//site.com'
];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question