GitHub Pages CSS resetting itself

Published
December 30th, 2023

Sometimes when I publish a site via GitHub pages & Jekyll, I run into this weird issue where the style.css isn’t working. Well, it’s more than that really. When I inspect the code, I notice that the style.css is being rewritten into some weird default stylsheet—something I clearly have not written. However, looking at the repo, the source stylesheet is correct, and the stylesheet being generated into the /site folder is also correct. So something is going wrong outside of the build process, but where?

I found the solution once, and now I can’t seem to find it again. Everytime I run into this, I search for an hour, and then the solution slowly comes back to mind. So I am documenting it here for my future self and maybe anyone else running into the same issue.

In your _config.yml file, just add the following:

theme:

Yeah, nothing else after it. It seems that sometimes, unless stated otherwise, GitHub pages makes the assumption that you would like to use one of their default Jekyll themes so it injects a new stylesheet.

Filed under: CSS, Development, Git, Jekyll, Web

Learning to skate again