0

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>

enter image description here

I did the above things but still, it is not working. Can someone please help me with this? Thank you

asked Dec 1, 2020 at 12:14
3
  • 1
    magento.stackexchange.com/a/247395/51810 Try using this answer. Commented 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 updates Commented 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 that Commented Dec 31, 2020 at 19:03

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.