Suddenly the css files stopped being loaded on my site. I found they are no longer being rendered in the <head>. Normally they would look like:

<link  rel="stylesheet" type="text/css"  media="all" href=".../mage/calendar.css" />
<link  rel="stylesheet" type="text/css"  media="all" href=".../css/styles-m.css" />
<link  rel="stylesheet" type="text/css"  media="all" href=".../css/main.css" />
<link  rel="stylesheet" type="text/css"  media="screen and (min-width: 768px)" href=".../css/styles-l.css" />
<link  rel="stylesheet" type="text/css"  media="print" href=".../css/print.css" />

calendar.css is still there but the order are just not being output to the page source which of course causes the page to have no css and look like it has no design.

I tracked the file in the layout which is responsible for rendering the tags to vendor/magento/theme-frontend-blank/Magento_Theme/layout/default_head_blocks.xml which has the lines:

    <css src="css/styles-m.css"/>
    <css src="css/styles-l.css" media="screen and (min-width: 768px)"/>
    <css src="css/print.css" media="print"/>
    <meta name="format-detection" content="telephone=no"/>

None of this is being rendered on the page even the meta tag. So I'm guessing this file is not being used at all which makes me think something is wrong with my inheritance of the theme. I'm using a custom theme which is a child of Infortis/ultimo which is a child of Infortis/base which is a child of Magento/blank. There's 3 levels of inheritance but it was working and I believe pretty standard way of creating themes.

Mostly I need help on how to debug this problem as I've exhausted all the tools I know. No useful information is in any of the logs. Is there a way to check that the theme inheritance is working and each parent is being loaded correctly?

Edit: Before you suggest it I should note I have cleared all the caches with:

bin/magento cache:clean
bin/magento cache:flush
rm -r var/view_preprocessed/*
rm -r pub/static/*
rm -r pub/cache/*
rm -r pub/page_cache/*
rm -r generated/*

and it didn't help.

  • Have you tried running bin/magento setup:static-content:deploy ?
    – Joshua34
    Jun 14, 2021 at 16:31
  • Yes, I'm currently running in developer mode so it shouldn't be necessary but I ran it with -f and it didn't help. Jun 14, 2021 at 16:49
  • Do you have a child theme that could be overwriting the files?
    – web master
    Jun 14, 2021 at 16:55
  • I have found that this usually points to some sort of error in the less files which are being compiled. Did you make any recent changes which you can revert and retest?
    – Joshua34
    Jun 14, 2021 at 16:58
  • I did make some recent changes no less files but reverting them made no difference and I double checked that the changes are safe. They were only in styles-product-page.less which shouldn't affect the main styles. Jun 14, 2021 at 17:18

1 Answer 1


I figured out the problem and it was related to my rather unusually dev machine. I will record the debug process I used in hopes it will provide value to others.

Using xdebug I was able to trace the problem down to this regex. It looked like it should match but was not matching so many xml files like default_head_blocks.xml were not scanned. I created a simple script to test the regex:

$pattern = '#/([^/])+/layout/([^/]*)(\.xml)$#i';
$filename = '/home/dave/magento/app/design/frontend/Infortis/ultimo/Infortis_Ultimo/layout/default.xml';
if (!preg_match($pattern, $filename, $matches)) {
    die('miss, it should match!');

This simple script did not match as it should. I tried running it in a php online codepad http://phptester.net/ and it worked so I know something was wrong with my php version and pcre. php -i indicated I had PCRE Library Version => 10.37 2021-05-26. Since it was recently released I did a quick online search and found this bug in php homebrew which lead to this bug in php core and ultimately this bug in the PCRE library. I use Clear Linux on my dev machine which has a rolling release so PCRE lib was recently updated to 10.37 which is why Magento seemed to just break for no apparent reason.

The workaround is to add pcre.jit=0 to php.ini. Once I did this the page rendered properly.

I was guessing the problem would be with Magento or some poor quality third party extension I was using but really the source of the problem is my desire to run a bleeding edge distribution like Clear Linux.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.