Chapter 2. Core Elements of Gatsby

In Chapter 1, we covered some of the most important foundations you’ll need to be familiar with as you begin working with Gatsby and walked through creating a rudimentary “Hello World” site in Gatsby in your local development environment. In this chapter, we’ll dive into what we covered at the end of Chapter 1 in more detail. I’ll provide more information about the Gatsby CLI, working with starters, how Gatsby pages and components work, the layout component, CSS in Gatsby, and how to add plugins to your site.

We explored the Gatsby CLI at some length at the end of Chapter 1, because it is the primary conduit by which you, as a Gatsby developer, will interact with your Gatsby sites. Many common tasks for Gatsby development can be performed with the Gatsby CLI, and we’ll return frequently to Gatsby CLI commands throughout this book. For this reason, it’s only logical that we start with a closer look at CLI and what it can do to accelerate your Gatsby development workflows.

The Gatsby CLI

As you saw in Chapter 1, the Gatsby CLI is the primary means by which developers interact with Gatsby sites during development. It’s the main way to set up a new Gatsby application through scaffolding (generation of files and directories adhering to a boilerplate template) and to run a development server for debugging. In this overview of the Gatsby CLI, we’ll take another look and discuss some of the most important commands.

Installing and Configuring the Gatsby ...

Get Gatsby: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.