S
S
Sergey2018-07-21 15:49:51
Yii
Sergey, 2018-07-21 15:49:51

How to exclude assets in yii2?

In /frontend/assets/appAsset.php I include jquery:

public $js = [
        'js/libs/jquery-3.3.1.min.js',
         ...
];

on one of the pages i use a widget that pulls jquery from somewhere else. As a result, there are two libraries on the page with all the ensuing errors. I need to exclude one of the assets and the widget asset would be better (there is not the latest version of jquery).
Changing the widget code, I think, is wrong, because everything was installed through composer and in case of an update, there may be problems if I climb and edit the code of third-party elements, so I want to exclude the asset of the widget with jquery.
How can I do this in the view file or at least in the controller?
Or is it possible to set it somewhere else?
I know that it is possible to connect an asset for each page with handles in the view file, but for the sake of one page without a library, editing all the rest by hand is also somehow not right.
Or maybe it's possible in the config to somehow prohibit all widgets from pulling jquery?
In general, I will listen to advice on what can be done and how to do it as beautifully as possible.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2018-07-21
@butteff

In config

'assetManager' => [
    'bundles' => [
        'yii\web\JqueryAsset' => [
            'js'=>[]
        ],
    ],
],

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question