Reading list Switch to dark mode

    How to remove JS and CSS in Magento 2 using layout XML

    Updated 7 August 2018

    Sometimes, there is a need to remove some CSS and JS from a page as there may be conflictions between the theme and module CSS and JS.

    In order to remove CSS and JS from a page, <remove> tag is used in layout XML under the <head> tag.

    <page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
            <remove src="name.css"/>
            <remove src="css/name.css"/>
            <remove src="js/name.js"/>
            <remove src="Vendor_Module::js/name.js"/>

    For more reference please visit the following link –

    Searching for an experienced
    Magento 2 Company ?
    Read More
    . . .
    Discuss on Helpdesk

    Leave a Comment

    Your email address will not be published. Required fields are marked*


  • luenib
    How do I determine the path to the files I want to remove? In the case off “css/name.css” how come this path includes “css/” but not the path to “name.css”?


    • Sagar Bathla (Moderator)
      This is just an example, the case “name.css” means it is kept inside the web folder and the case “css/name.css” it is kept inside web/css folder.
  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home