Magento 2 custom theme layout xml and css not working

Magento 2 custom theme layout xml and css not working after changing the theme name. In our custom theme, we have used theme name like Custom (First letter capital). Then we have decided to change the theme name like custom. After doing this our theme css and XML files are not loaded.
The reason is default_head_blocks.xml is no longer pulling any css or XML files that I included.

Steps to change the theme name in files

1. Change the custom theme directory name
/app/design/frontend/Vendor/custom

2. Change theme name in registration.php (/app/design/frontend/Vendor/custom/registration.php

3. Change the theme name in theme.js file
/dev/tools/grunt/configs/themes.js

4. If you have used any composer file change the theme name in that file also.

DB changes

Check your DB. There is a table called theme that stores a reference to all the themes that have ever been installed in your store. If the type of the theme is set to 1, that means Magento sees the theme are virtual (what ever that means) and will no longer load your xml files. If that is the case, just change it to 0.

Then give the permission, and clean the cache from pub/static and var/view_preprocessed . The deploy the static content using

Then refresh the page. It will work

Share this article

Leave a comment