Lawrence Phillips Lawrence Phillips - 1 year ago 130
CSS Question

Magento 2 custom theme css not showing

I have created a custom Magento 2 theme called 'gvtheme'.
The folder layout for the css is: frontend->Magento->gvtheme->web->css->source->style.css

In style.css I have put body: background-color: red; just to test if it is working. When I inspect the body tag in chrome it is not showing up, not even as an overridden style.

In Content/Design/Configuration in the Magento 2 backend it's showing that the 'Default Store View' and the other two views have 'gvtheme' as their theme. It was previously showing as 'Luma'.
On the frontend of the site it is no longer showing the 'Luma' logo and style. I have flushed all the caches including 'Flush Javascript/CSS Cache'.
Does anyone have any ideas why this might not be working?
Any help would be greatly appreciated!

Answer Source

Turns out I needed to add 'custom-theme'->'Magento_Theme'->'layout'->'default_head_blocks.xml'. In that file I needed to add:

<page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <css src="css/source/style.css" />

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download