cancel
Showing results for 
Search instead for 
Did you mean: 

CSS not loading in custom theme after migration

CSS not loading in custom theme after migration

I have a magento 1.9 installation up and running and Im moving it to magento 2.1.5. I developed a custom theme in Magento and is working properly. But when I migrated 1.9 database to 2.1.5 and connect it to the magento 2 theme, the css are not loading. I have selected my custom theme in admin section and when I deploy static content, the css are generating in pub/static folder as expected.

 

This is my default_head_blocks.xml of my custom theme in app/design/frontend/PackageName/ThemeName/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"/> -->
        <css src="common.css"/>
        <css src="css/source/custom/font-awesome.css"/>
        <script src="requirejs/require.js"/>
    </head>
    <body>
        <referenceContainer name="after.body.start">
            <block class="Magento\Framework\View\Element\Js\Components" name="head.components" as="components" template="Magento_Theme::js/components.phtml" before="-"/>
        </referenceContainer>
    </body>
</page>

I have deleted contents in var folder as well as pub/static folder ant done static content deploy, reindexing etc still it is not showing in frontend.

 

How can I include my css files in my theme?

 

2 REPLIES 2

Re: CSS not loading in custom theme after migration

@pradeep23

 

My first question is - does it show any CUSTOM CSS after migration? If not then you might wanna check the system locale as well. 

Secondly, check the file path as well. 

Magento Certified Solution Specialist | Lead Magento developer
If this response was helpful to you, consider giving kudos to this post

Re: CSS not loading in custom theme after migration

I developed a custom magento 2 theme in a vanilla magento 2 installation. It is working fine in that. But when the migrated DB is connected to that code base instead of vanilla magento 2 db, the css disappears. The files are present in theme folders as LESS files which gets converted when i deploy static content.