S
S
Sergey Beloventsev2018-05-17 16:20:32
Yii
Sergey Beloventsev, 2018-05-17 16:20:32

How to properly set up Assets?

I connect styles in assets but there was no problem, but when connecting, the styles of additions and extensions are connected higher, but I need it the other way around. Is it possible that the styles in the assets are connected before the styles of all extensions are connected.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-05-17
@webinar

I didn’t understand anything, but if assets have styles on which they are dependent, they should be written in dependencies.
Example, standard AppAsset:

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

The styles described, namely 'css/site.css' will be included after the styles described in yii\bootstrap\BootstrapAsset and yii\web\YiiAsset
This is why public $depends exists in the AssetBundle

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question