I am using Magento 2.3.5 and I would like to remove a CSS file from specific Content -> Pages
My default_head_blocks.xml file code is below
<?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>
<!-- ADD CSS -->
<css src="css/styles-m.css"/>
<css src="css/styles-l.css" media="screen and (min-width: 768px)"/>
<css src="css/print.css" media="print"/>
<css src="css/custom-sb.css"/>
</head>
</page>
I would like to remove custom-sb.css from some cms pages.
I have created a Custom Layout Update file and call it from the Design section of the page
My custom layout update file cms_page_view_selectable_home-grocery_microsite.xml
<?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/custom-sb.css"/>
<css src="css/custom-microsite.css"/>
</head>
</page>
I did the above things but still, it is not working. Can someone please help me with this? Thank you
-
1magento.stackexchange.com/a/247395/51810 Try using this answer.Rohan Hapani– Rohan Hapani2020年12月01日 12:26:33 +00:00Commented Dec 1, 2020 at 12:26
-
What theme are you currently using? The porto theme is notoriously unreliable when it comes to the new implementation of the custom xml layout updatesJerGrun– JerGrun2020年12月01日 12:38:48 +00:00Commented Dec 1, 2020 at 12:38
-
Curious you should try opposite way ? Add css only in specific page that you need instead include all page and remove after thatmrtuvn– mrtuvn2020年12月31日 19:03:08 +00:00Commented Dec 31, 2020 at 19:03