Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii2 - Change jQuery Version

Tags:

yii2

I want to change the jQuery version of yii2. I've installed yii2 through composer. I've read a similar question here: Change JqueryAsset's jQuery version on certain page

But the problem I'm facing is where should I place this code? Should I place it on the view page? But I want to change the jquery version for all the pages. Is this code compatible for yii2?

like image 781
Omar Tariq Avatar asked Feb 28 '15 13:02

Omar Tariq


1 Answers

You can easily customize jquery asset bundle by configuring assetManager in the application components configuration (usually config/web.php), for example if you want to use a jquery file in web/js folder :

        'assetManager' => [
            'bundles' => [
                'yii\web\JqueryAsset' => [
                    'sourcePath' => null,
                    'basePath' => '@webroot',
                    'baseUrl' => '@web',
                    'js' => [
                        'js/jquery.js',
                    ]
                ],
            ],
        ],

Read more : http://www.yiiframework.com/doc-2.0/guide-structure-assets.html#customizing-asset-bundles

like image 69
soju Avatar answered Oct 20 '22 22:10

soju