Shopify CLI serving empty CSS files

When I boot up Shopify CLI for a local theme I’m developing, everything loads as it should, and the theme looks correct. But sometimes, when I reload the page to test a change I’ve made, some CSS files are empty.

Example of the missing CSS.

Example of how it should look:

I have to restart Shopify CLI to get this working again.

Hey @herd-mark :waving_hand: - that is definitely strange, especially since it seems to fix itself after you restart the CLI.

Have you noticed any error messages in the CLI logs itself in your terminal when running the local dev server? If no, could you try running something like this and letting me know if you see any errors pop up when the CSS files appear empty:

shopify theme dev --verbose

If you do see any errors, feel free to share them here and I can take a look. If not, just let me know as well and I can DM you for next steps. If you’re comfortable sharing your theme files so that I can try and replicate the issue, I’m happy to try that on my end and we can follow up in the DMs - just let me know! :slight_smile:

Hi Alan, there are no error messages, and nothing looks off in the logs.

I’ll confirm with our team if they are happy to share the files.

I can, however, provide a quick overview of how we set up CSS for our themes in case it helps you narrow down why this might be happening. Our CSS is not compiled into a single ‘global’ CSS file; each section has its own CSS file. So if we have 12 sections on the homepage, 12 CSS files will be referenced in the section liquid.

It’s been happening for a while now and I’ve never been able to find out why. And it’s odd that only some CSS files are not loading.

1 Like