?>

How to override jQuery in yii2 project?

One option would be the following example:

In the config file of the project @ frontend / config / main.php add:

One option would be the following example:

In the config file of the project @ frontend / config / main.php add:

'components' => [ 'view' => [ 'on beforeRender' => function () { if (!\skeeks\cms\backend\BackendComponent::getCurrent()) { \Yii::$app->assetManager->bundles['yii\web\JqueryAsset'] = [ 'class' => '\frontend\assets\YourJqueryAsset', ]; } }, ], ] 

frontend \ assets \ YourJqueryAsset:

namespace frontend\assets; /** * @author Semenov Alexander <semenov@skeeks.com> */ class DigiproJsPluginsAsset extends DigiproAsset { public $sourcePath = '@webroot/'; public $css = []; public $js = [ 'jquery-version.min.js', ]; public $depends = []; } 

Option redefinition not only jquery but also any other scripts.

All Comments (0)
No Comments