When we create store pages, we can add JS and CSS to make the page look better, more attractive. After using it for a while and you find that it is no longer useful, it is time to remove the JS and CSS from the store page. In this article, I will show you how to remove JS and CSS in Magento 2 using XML.
Step By Step
Step 1: You create an xml file in the folder app/design/frontend///Magento_Theme/layout.
Step 2: Use the tag like the code below to remove the JS and CSS you want:
<?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="css/name.css"/> <remove src="js/name.js"/> </head> </page>
This guide above has shown you how to remove js and css in Magento 2 by adding tag in XML. Thanks for reading!