['js' => [],'sourcePath' => null,]," to remove the jquery script."/> ['js' => [],'sourcePath' => null,]," to remove the jquery script.">
search
HomePHP FrameworkYIIHow to remove jquery in yii2

How to remove jquery in yii2

Feb 17, 2023 am 09:55 AM
jqueryyii2

yii2 Method to remove jquery: 1. Edit the AppAsset.php file and comment out the "yii\web\YiiAsset" value in the variable $depends; 2. Edit the main.php file and under the field "components" Add the configuration "'yii\web\JqueryAsset' => ['js' => [],'sourcePath' => null,]," to remove the jquery script.

How to remove jquery in yii2

The operating environment of this article: Windows 10 system, version yii2.0, Dell G3 computer.

yii2 How to remove jquery?

Completely disable the built-in Yii, JQuery and Bootstrap scripts in Yii2 [Version 2.0]

By default, Yii2 Scripts and styles such as Yii, JQuery and Bootstrap are automatically loaded, but sometimes these libraries may not be needed in the project, or other versions are used; here is how to remove these library scripts and styles.

▪ Remove Yii.js related scripts

Edit the frontend\asset\AppAsset.php file and comment out the 'yii\web\YiiAsset' value in the variable $depends.

Edit the frontend\config\main.php file and add configuration under the field 'components':

'assetManager' => [
 'bundles' => [
     'yii\web\YiiAsset' => [
         'js' => [],  // 去除 yii.js
         'sourcePath' => null,  // 防止在 frontend/web/asset 下生产文件
     ],
                        
     'yii\widgets\ActiveFormAsset' => [
         'js' => [],  // 去除 yii.activeForm.js
         'sourcePath' => null,  // 防止在 frontend/web/asset 下生产文件
     ],
        
     'yii\validators\ValidationAsset' => [
         'js' => [],  // 去除 yii.validation.js
         'sourcePath' => null,  // 防止在 frontend/web/asset 下生产文件
     ],
 ],
],

▪ Remove JQuery script

Edit frontend\config\main.php file, add configuration under the field 'components':

'assetManager' => [
    'bundles' => [
        'yii\web\JqueryAsset' => [
            'js' => [],  // 去除 jquery.js
            'sourcePath' => null,  // 防止在 frontend/web/asset 下生产文件
        ],
    ],
],
  • Remove Bootstrap library

Edit frontend\asset\AppAsset.php file, comment Remove the 'yii\bootstrap\BootstrapAsset' value in the variable $depends.

Edit the frontend\config\main.php file and add the configuration under the field 'components':

'assetManager' => [ 'bundles' => [     'yii\bootstrap\BootstrapAsset' => [         'css' => [],  // 去除 bootstrap.css
         'sourcePath' => null, // 防止在 frontend/web/asset 下生产文件
     ],     'yii\bootstrap\BootstrapPluginAsset' => [         'js' => [],  // 去除 bootstrap.js
         'sourcePath' => null,  // 防止在 frontend/web/asset 下生产文件
     ],
 ],


],

Recommended: "yii tutorial

The above is the detailed content of How to remove jquery in yii2. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What Skills Are Required to Become a Successful Yii Developer?What Skills Are Required to Become a Successful Yii Developer?May 13, 2025 am 12:01 AM

TobecomeasuccessfulYiideveloper,youneed:1)PHPmastery,2)understandingofMVCarchitecture,3)Yiiframeworkproficiency,4)databasemanagementskills,5)front-endknowledge,6)APIdevelopmentexpertise,7)testinganddebuggingcapabilities,8)versioncontrolproficiency,9)

Yii Developers: Common ErrorsYii Developers: Common ErrorsMay 12, 2025 am 12:04 AM

ThemostcommonerrorsinYiiframeworkare"UnknownProperty","InvalidConfiguration","ClassNotFound",and"ValidationErrors".1."UnknownProperty"errorsoccurwhenaccessingnon-existentproperties;ensurepropertiesexi

Yii Developer: Most recquired skills in EuropeYii Developer: Most recquired skills in EuropeMay 11, 2025 am 12:02 AM

The key skills that European Yii developers need to possess include: 1. Yii framework proficiency, 2. PHP proficiency, 3. Database management, 4. Front-end skills, 5. RESTful API development, 6. Version control system, 7. Testing and debugging, 8. Security knowledge, 9. Agile methodology, 10. Soft skills, 11. Localization and internationalization, 12. Continuous learning, these skills make developers stand out in the European market.

Yii: Is the community still active?Yii: Is the community still active?May 10, 2025 am 12:03 AM

Yes,theYiicommunityisstillactiveandvibrant.1)TheofficialYiiforumremainsaresourcefordiscussionsandsupport.2)TheGitHubrepositoryshowsregularcommitsandpullrequests,indicatingongoingdevelopment.3)StackOverflowcontinuestohostYii-relatedquestionsandhigh-qu

Is it easy to migrate a Laravel Project to Yii?Is it easy to migrate a Laravel Project to Yii?May 09, 2025 am 12:01 AM

Migratingalaravel Projecttoyiiishallingbutachieffable WITHIEFLEFLANT.1) Mapoutlaravel component likeroutes, Controllers, Andmodels.2) Translatelaravel's SartisancommandeloequentTooyii's giiandetiverecordeba

Essential Soft Skills for Yii Developers: Communication and CollaborationEssential Soft Skills for Yii Developers: Communication and CollaborationMay 08, 2025 am 12:11 AM

Soft skills are crucial to Yii developers because they facilitate team communication and collaboration. 1) Effective communication ensures that the project is progressing smoothly, such as through clear API documentation and regular meetings. 2) Collaborate to enhance team interaction through Yii's tools such as Gii to improve development efficiency.

Laravel MVC : What are the best benefits?Laravel MVC : What are the best benefits?May 07, 2025 pm 03:53 PM

Laravel'sMVCarchitectureoffersenhancedcodeorganization,improvedmaintainability,andarobustseparationofconcerns.1)Itkeepscodeorganized,makingnavigationandteamworkeasier.2)Itcompartmentalizestheapplication,simplifyingtroubleshootingandmaintenance.3)Itse

Yii: Is It Still Relevant in Modern Web Development?Yii: Is It Still Relevant in Modern Web Development?May 01, 2025 am 12:27 AM

Yiiremainsrelevantinmodernwebdevelopmentforprojectsneedingspeedandflexibility.1)Itoffershighperformance,idealforapplicationswherespeediscritical.2)Itsflexibilityallowsfortailoredapplicationstructures.However,ithasasmallercommunityandsteeperlearningcu

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.