Deploy to GitHub Pages and generate .nojekyll
and CNAME
files to output directory. Create & push to gh-pages subtree.
touch ./gitignore
sed -i '/.output/d' .gitignore # remove .output from .gitignore
npm run generate
touch .output/public/.nojekyll
echo "yourdomain.com" > .output/public/CNAME # only necessary for custom domain
git add .
git commit -m "Deploying static site"
git push origin main
git push origin HEAD:gh-pages # only needed first time
git subtree split --prefix .output/public -b gh-pages
git push -f origin gh-pages:gh-pages
You can automatically create .nojekyll
and CNAME
files by adding the following to the package.json
generate script:
"generate": "nuxi generate && touch .output/public/.nojekyll && echo 'yourcustomdomain.com' > .output/public/CNAME",
- To deploy to GitHub Pages you must go to your repo settings, then pages and select
Deploy from a branch
followed bygh-pages
for branch. - Import your CSS file in the app.vue script tag.
For more info on static site deployment using Nuxt, check out the documentation here.
Credit to @tduarte for his gist that originally helped me out with this issue: https://gist.github.com/tduarte/eac064b4778711b116bb827f8c9bef7b