Quick Start with Gatsby from the Command Line

Obinna Ekwuno
InstructorObinna Ekwuno
Share this video with your friends

Social Share Links

Send Tweet

In this lesson you will learn how to Create, Develop, and Build Gatsby Sites from the Command Line, by installing the Gatsby CLI globally and using the Gatsby develop, Gatsby build and Gatsby serve commands.

It also goes further to show helpful commands, that can be used when running a Gatsby site from the terminal.

Obinna Ekwuno: [0:00] The first step is to install the Gatsby CLI globally on your computer by running npm install -g gatsby-cli so that you'd be able to access dependencies on packages needed to run a new Gatsby site.

[0:18] When that is over, we want to initialize a new Gatsby site by running gatsby new followed by the site's name. In this case we'll call our site gatsby-site.

[0:34] We will then change the directory to the site by using the Bash command cd gatsby-site. Then we input gatsby develop in order to run the site in development mode. This makes the site available at localhost:8000. If we move out to the browser, we can see the site served.

[0:59] We can also build the production ready version of Gatsby sites by running gatsby build in the terminal. This creates a static HTML file that can be rendered on the server. Once the site is built, you can run it by using the gatsby serve command to generate the site's URL at localhost:9000. If we move out to the browser, we can see that the production ready site is served.

[1:30] We have gone through the basics of developing, building, and saving a Gatsby site. There are helpful commands that aid in this process, and they can be accessed by running gatsby --help. We can see a list of commands that help to get more information about cleaning cache, build, serve, information, amongst others.

[1:49] You can also get additional information about the specific command by appending --help after repeating the command.