Skip to main content

Fix missing Astro files on GitHub pages

I’m in the middle of a long project to migrate my projects from Netlify to GitHub pages. I was working on the GitHub actions for an Astro project and noticed that most of the CSS files were missing from the assets directory.

When I built the project locally, I saw the following:


The index.3e3ecbbf.css file was the only CSS one that was successfully deployed. That led me to think that there was something about the underscore prefix that was causing the other files to be ignored.

GitHub Pages uses Jekyll behind the scenes, even if your site doesn’t use it. And Jekyll ignores files and directories that start with an underscore. So the solution is to tell GitHub to skip Jekyll processing of your build directory with a .nojekyll file.

In the GitHub Action for the Astro project, I added the following line to the build step:

touch dist/.nojekyll

Once that was added, all of the generated CSS files were successfully deployed to GitHub Pages.

There is also an official action for Astro projects that probably handles that for you.