CSS return 404 after a successful build while accessing the published preview

My style.css return 404 error after build is successful. When I checked the sources tab on devtool it shows that style.css is empty.

Then I tried similar process locally by running yarn build, after a successful build. I accessed the url in a browser, all assets loads correctly without 404 error and i confirmed that style.css is not empty.

Hi @Ahmzyjazzy,

Welcome to the Netlify community

If you download your published site you can see if the CSS file was deployed, and where.

Click on the last published deploy then click the arrow as indicated below.

Thank you @coelmay i noticed there is no css folder after downloading the generated zip. See attachment below.

great, that gives some information to help debugging. where is the css folder located in your source files? maybe it is the wrong place so it doesn not get included in the build step? :thinking:

I got this same issue too. Just playing with an 11ty SSG. Decided to tidy up a bit by moving my single ‘style.css;’ from the root to ‘/_assests/css/style.css’ and it all broke when deployed due to the same 404 and the file not being present in the site zip artifact.

It runs fine on local host. The build command ‘npm run build’ correctly copies the file in the output directory on my local machine, so, not sure why it did not make it into the CI zip.

Luckily, I am just messing around and it is not a produciton site! Would be interest to know what config I have missed though.

Sorted it. An obvious one in the end. The ‘.gitignore’ file for the project had a very broad ‘css’ clause. This was prevented it getting checked in and hence it was missing from the artifact as 11ty had nothing to copy over on the remote build machine.

Nothing to do with the Netlify deployment mechanism!