S
S
Sergey Beloventsev2018-12-12 14:01:54
Yii
Sergey Beloventsev, 2018-12-12 14:01:54

What is the correct way to create a resource dependency?

in AssetBundle there is such an array depends, I need to configure it in such a way that there would be an order for connecting scripts in the following way
1 jquery; 2 my scripts; 3 scripts in extensions.
How can this be configured?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kim, 2018-12-12
@kimono

class MyAsset {
  public $js = ['my.js', 'third-party.js'];
  public $depends = [YiiAsset::class];
}

or even like this:
class MyAsset {
  public $js = ['my.js'];
  public $depends = [YiiAsset::class];
}

class ThirdPartyAsset {
  public $js = ['other.js'];
  public $depends = [MyAsset::class];
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question