How to Remove JS and CSS using Layout XML in Magento 2

 Step 1: Go to your layout file


app\code\Vendor\Extension\view\frontend\layout\your_layout_file.xml 


To remove JS and CSS, you need to add <remove> tag in layout XML under the <head> tag.


<?xml version="1.0"?>

 

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

 

    <head>

        <remove src="Vendor_Extension::css/custom.css"/>

        <remove src="Vendor_Extension::js/custom.js"/>

    </head>

 

</page>

Comments

Popular posts from this blog

Add Admin User name and Action name in Order Comment Section through Action Performed from Sales Order Grid in Magento 2

How to Update Product Stock Programmatically in Magento 2

How to Set and Get Cookie in Magento 2