Skip to content

Instantly share code, notes, and snippets.

@bgrand-ch
Last active November 15, 2020 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgrand-ch/a2bfb1dfce07027023668dce9c2391e4 to your computer and use it in GitHub Desktop.
Save bgrand-ch/a2bfb1dfce07027023668dce9c2391e4 to your computer and use it in GitHub Desktop.
Netlify Site Configuration (Nuxt.js and others)

CLI needed:

1- Create a site folder and move into it.

https://unix.stackexchange.com/a/219627

mkdir <site-name> && cd $_

2- Install and configure a Nuxt.js project (or an other).

https://nuxtjs.org/docs/2.x/get-started/installation

yarn create nuxt-app

3- Select "Git" as version control system or initialize it.

https://github.com/git-guides/git-init

git init -b main

4- Create a remote GitHub repository.

https://cli.github.com/manual/gh_repo_create

gh repo create

5- Create a netlify.toml file and a .env.example file.

https://linuxize.com/post/create-a-file-in-linux/

https://docs.netlify.com/configure-builds/file-based-configuration/

https://gist.github.com/DavidWells/43884f15aed7e4dcb3a6dad06430b756

touch netlify.toml .env.example

6- Push files to the GitHub repository (add, commit & push).

https://github.com/git-guides/git-push

git push origin main

7- Initialize Netlify and create a new site (deploy is automatic).

Warning: Write the name of the directory to deploy (not default).

https://cli.netlify.com/commands/init

netlify init

8- Copy .env.example file and import .env variables.

https://linuxize.com/post/how-to-copy-files-and-directories-in-linux/

https://cli.netlify.com/commands/env

netlify env:import .env

9- On Netlify website, stop automatic builds and deploys.

https://docs.netlify.com/configure-builds/stop-or-activate-builds/

10- After edited files, preview and deploy new version.

https://cli.netlify.com/commands/deploy

netlify deploy --open netlify deploy --prod

Useful links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment