DEV Community

Discussion on: Deploying a Next.js app to GitHub Pages

Collapse
 
ottobonn profile image
Travis Geis • Edited

Thanks for the guide! I also had trouble with CSS, but it was because by default Github Pages ignores the _next directory because it assumes names prefixed with underscore are Jekyll files. You can add a .nojekyll file to the root of your Next public directory (so it ends up in the GH Pages root) to disable Jekyll processing.

I use gh-pages locally to deploy to Github, and to get that to deploy the .nojekyll dotfile, you also have to add the --dotfiles option to it. So in my package.json, my deploy script ends up being "deploy": "gh-pages --dotfiles --dist out".

Cheers!

Collapse
 
jameswallis profile image
James Wallis

Good to know! Thanks Travis.