Quick Start with Gatsby from the Command Line

Obinna Ekwuno
InstructorObinna Ekwuno
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 3 years ago

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.

egghead
egghead
~ 23 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today