{"id":137103,"date":"2018-08-07T06:43:01","date_gmt":"2018-08-07T06:43:01","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=137103"},"modified":"2024-04-08T09:57:35","modified_gmt":"2024-04-08T09:57:35","slug":"how-to-remove-js-and-css-in-magento-2-using-layout-xml","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/","title":{"rendered":"How to remove JS and CSS in Magento 2 using layout XML"},"content":{"rendered":"\n<p>Sometimes, there is a need to remove some static resources(<a href=\"https:\/\/webkul.com\/blog\/magento-development-11-css-and-js\/\">CSS and JS<\/a>) from a page as there may be conflicts between the theme and the module(extensions) static resources(CSS and JS).<\/p>\n\n\n\n<p>The &lt;remove&gt; tag is used in layout XML under the &lt;head&gt; tag to remove the static resources(CSS and JS files) linked to a page.<\/p>\n\n\n\n<p>Note, that if a static asset is added with a module path (for example Vendor_Module::js\/name.js) in the initial layout, you need to specify the module path when removing the asset.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;page xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd&quot;&gt;\n   &lt;head&gt;\n      &lt;remove src=&quot;name.css&quot;\/&gt;\n      &lt;remove src=&quot;css\/name.css&quot;\/&gt;\n      &lt;remove src=&quot;js\/name.js&quot;\/&gt;\n      &lt;remove src=&quot;Vendor_Module::js\/name.js&quot;\/&gt;\n   &lt;\/head&gt;\n&lt;\/page&gt;<\/pre>\n\n\n\n<p>If you want to remove static resources(CSS and JS files) on all pages then you need to create a <strong>default.xml<\/strong>, the code will be as above only.<\/p>\n\n\n\n<p>For more reference please visit the following link &#8211; <a href=\"https:\/\/webkul.com\/blog\/understanding-magento-theme-layout-customizations\/\">Layout customizations<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes, there is a need to remove some static resources(CSS and JS) from a page as there may be conflicts between the theme and the module(extensions) static resources(CSS and JS). The &lt;remove&gt; tag is used in layout XML under the &lt;head&gt; tag to remove the static resources(CSS and JS files) linked to a page. Note, <a href=\"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":204,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[302],"tags":[217,1894,2460],"class_list":["post-137103","post","type-post","status-publish","format-standard","hentry","category-magento2","tag-css","tag-js","tag-magento-2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to remove JS and CSS in Magento 2 using layout XML<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to remove JS and CSS in Magento 2 using layout XML\" \/>\n<meta property=\"og:description\" content=\"Sometimes, there is a need to remove some static resources(CSS and JS) from a page as there may be conflicts between the theme and the module(extensions) static resources(CSS and JS). The &lt;remove&gt; tag is used in layout XML under the &lt;head&gt; tag to remove the static resources(CSS and JS files) linked to a page. Note, [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-07T06:43:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-08T09:57:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Sagar Bathla\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sagar Bathla\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/\"},\"author\":{\"name\":\"Sagar Bathla\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/6fcd235eb54dfa1a0fbfc662b8618463\"},\"headline\":\"How to remove JS and CSS in Magento 2 using layout XML\",\"datePublished\":\"2018-08-07T06:43:01+00:00\",\"dateModified\":\"2024-04-08T09:57:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/\"},\"wordCount\":147,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"keywords\":[\"css\",\"js\",\"Magento 2\"],\"articleSection\":[\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/\",\"url\":\"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/\",\"name\":\"How to remove JS and CSS in Magento 2 using layout XML\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"datePublished\":\"2018-08-07T06:43:01+00:00\",\"dateModified\":\"2024-04-08T09:57:35+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to remove JS and CSS in Magento 2 using layout XML\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/6fcd235eb54dfa1a0fbfc662b8618463\",\"name\":\"Sagar Bathla\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/06e15f8abbf8155cc1124049027a7849db68d785d26bd10e4932883b83def757?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/06e15f8abbf8155cc1124049027a7849db68d785d26bd10e4932883b83def757?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Sagar Bathla\"},\"description\":\"Sagar Bathla, a Magento Certified Developer, is an expert in Magento 2 development and eCommerce platforms. He specializes in creating cutting-edge Headless PWA solutions, ensuring scalability and exceptional user experiences. Sagar's focus on innovative technology results in transformative digital growth.\",\"url\":\"https:\/\/webkul.com\/blog\/author\/sagar-bathla901\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to remove JS and CSS in Magento 2 using layout XML","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/","og_locale":"en_US","og_type":"article","og_title":"How to remove JS and CSS in Magento 2 using layout XML","og_description":"Sometimes, there is a need to remove some static resources(CSS and JS) from a page as there may be conflicts between the theme and the module(extensions) static resources(CSS and JS). The &lt;remove&gt; tag is used in layout XML under the &lt;head&gt; tag to remove the static resources(CSS and JS files) linked to a page. Note, [...]","og_url":"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2018-08-07T06:43:01+00:00","article_modified_time":"2024-04-08T09:57:35+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png","type":"image\/png"}],"author":"Sagar Bathla","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Sagar Bathla","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/"},"author":{"name":"Sagar Bathla","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/6fcd235eb54dfa1a0fbfc662b8618463"},"headline":"How to remove JS and CSS in Magento 2 using layout XML","datePublished":"2018-08-07T06:43:01+00:00","dateModified":"2024-04-08T09:57:35+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/"},"wordCount":147,"commentCount":2,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"keywords":["css","js","Magento 2"],"articleSection":["Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/","url":"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/","name":"How to remove JS and CSS in Magento 2 using layout XML","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"datePublished":"2018-08-07T06:43:01+00:00","dateModified":"2024-04-08T09:57:35+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-to-remove-js-and-css-in-magento-2-using-layout-xml\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to remove JS and CSS in Magento 2 using layout XML"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/6fcd235eb54dfa1a0fbfc662b8618463","name":"Sagar Bathla","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/06e15f8abbf8155cc1124049027a7849db68d785d26bd10e4932883b83def757?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/06e15f8abbf8155cc1124049027a7849db68d785d26bd10e4932883b83def757?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Sagar Bathla"},"description":"Sagar Bathla, a Magento Certified Developer, is an expert in Magento 2 development and eCommerce platforms. He specializes in creating cutting-edge Headless PWA solutions, ensuring scalability and exceptional user experiences. Sagar's focus on innovative technology results in transformative digital growth.","url":"https:\/\/webkul.com\/blog\/author\/sagar-bathla901\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/137103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/204"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=137103"}],"version-history":[{"count":13,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/137103\/revisions"}],"predecessor-version":[{"id":432351,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/137103\/revisions\/432351"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=137103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=137103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=137103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}