1

How do I delete the following files from the front end?

Here is the code I inserted. It doesn't work.

magento/app/design/frontend/Infortis/base/Magento_Theme/layout/default_head_blocks.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0" />
    <remove src="Magento_Theme::mage/calendar.css"/>
    <remove src="Amasty_ShopbyBase::css/swiper.min.css"/>
</head>

Then, after editing and saving, I executed the following command:

sudo php71 bin/magento setup:upgrade
sudo php71 bin/magento setup:static-content:deploy -f
sudo php71 bin/magento cache:clean
sudo php71 bin/magento cache:flush
  • Have you run php bin/magento s:s:d -f command? – Chirag Patel May 2 at 4:32
  • I just changed my question. – mr.hironobu May 2 at 4:36
  • Code seems ok, What is the location of this layout? – Amit Bera May 2 at 4:37
  • magento/app/design/frontend/Infortis/base/Magento_Theme/layout/default_head_blocks.xml – mr.hironobu May 2 at 4:41
  • This is the location of the layout. – mr.hironobu May 2 at 4:44
1

Add the following code in default_head_blocks.xml :

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <remove src="name.css"/>
    </head>
</page>

Remove static resources (JavaScript, CSS, fonts)

0

You are going in the right way, you can remove css from xml file.

Let see calendar.css it is added from vendor vendor\magento\module-theme\view\frontend\layout\default_head_blocks.xml and the file code to add this file is:

<head>
    <css src="mage/calendar.css"/>
</head>

Now to remove this file just use path, not Magento_Theme

Like this:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <remove src="mage/calendar.css"/>
    </head>
</page>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.