0

Its a pretty simple and straightforward question, at the moment my theme seems to be pulling through the following:

Vendor/default/en_GB/Magento_Swatches/css/swatches.css

this isn't in my theme, and Magento_Swatches folder doesn't exist, its obviously pulling from the core.

But i don't want this, i've written my own styles for it and dont want it there. I tried in the following way:

Vendor/default/Magento_Theme/layout/default_head_blocks.xml

<remove src="Magento_Swatches/css/swatches.css" />

or

<remove src="css/swatches.css" />

Neither seems to work. Does anyone know?

2

Okay, i found the solution:

<remove src="Magento_Swatches::css/swatches.css"/>

I didn't realise the :: was required. If anyone comes across this, hope it helps.

@Andy. Thank you for the solution it worked for me. This was helpful. The error was driving me crazy. Just want to add a suggestion. I am working on Magento 2.3.

Create a file in your theme folder, if it does not already exist. Do not modify Magento core files.

vi {mage_root_location}/app/design/frontend/Mgs/{your_theme_name}/Magento_Theme/layout/default_head_blocks.xml

Inside that file find the tag and add

<remove src="Magento_Swatches::css/swatches.css"/>

Should end up looking something 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="Magento_Swatches::css/swatches.css"/>
        ...
    </head>
</page>

Source: https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/layouts/xml-manage.html

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.