Hi all,
I'm trying to upgrade my website from Magento 2.2.3 to 2.3.5-p2.
So far it has been going good and I'm running into very minor issues and managed to solve most of them.
The last hurdle for me is that my custom .css file is not loading.
I've tried searching for fixes on the web and none of them have worked so far.
I have my css set in
"Kidsaw\kidmag2\Magento_Theme\layout\default_head_blocks.xml"
It reads as:
<?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <head> <css src="css/kidsaw.css" rel="stylesheet" type="text/css" media="All" /> </head> </page>
My css is placed:
"Kidsaw\kidmag2\web\css\kidsaw.css"
Again, I've tried everything from flushing caches, static deployment, removing pub/static / var/view_preprocessed etc etc but it is not loading. I also can't see anything within log files to find an error message.
Anyone have an idea?
Solved! Go to Solution.
Finally found the solution after 2 days of searching:
The 'type' field in the 'theme' database table was set wrong. On my custom theme the 'type' value was set to 1 (virtual) and changing it to 0 (physical) and flushing cache resolved the problem.
Source:
https://github.com/magento/magento2/issues/2547#issuecomment-289663976
Hello @callam_kidsaw
Please try this code:
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <head> <css src="css/kidsaw.css" /> </head> </page>
I hope it helps
Hi,
I tried your code, but still not working.
I removed files from these folders:
var/cache
var/view_preprocessed
generated
then ran setup:static-content:deploy -f
My custom css file is showing in the following folder when deploying:
pub/static/frontend/Kidsaw/kidmag2/en_GB/css
When using the Inspect tool on Firefox browser, I can see that the .css file is not being loaded.
Finally found the solution after 2 days of searching:
The 'type' field in the 'theme' database table was set wrong. On my custom theme the 'type' value was set to 1 (virtual) and changing it to 0 (physical) and flushing cache resolved the problem.
Source:
https://github.com/magento/magento2/issues/2547#issuecomment-289663976