Category: Uncategorized
-
Gatsby Theme Conventions
Because Gatsby themes are relative newcomers to the Gatsby ecosystem, having only emerged in the last several years as of this writing, theme conventions are still solidifying. Nonetheless, there are certain best practices that all Gatsby themes should follow to ensure their proper usage. In this section, we’ll cover naming conventions, separation of concerns, theme customization,…
-
Creating New Themes
Because Gatsby has a vested interest in the community contributing themes back into the ecosystem, it provides an official starter for creating themes from scratch known as gatsby-starter-theme-workspace. This starter can be used to scaffold a new theme alongside a site that you can use to try out the theme: When you change directories into the codebase,…
-
Creating Gatsby Themes
It’s often the case that no existing theme in the Gatsby ecosystem quite satisfies your requirements. If you’re implementing multiple Gatsby sites that share a certain modicum of functionality based on a theme, it may be a good idea to write your own theme. In this section, we’ll examine how to create new themes using…
-
Using Multiple Gatsby Themes
One of the characteristics of Gatsby themes that makes them unique is their composability. Though theme composition is a topic deserving of its own examination, for now it’s enough to know that the fact that Gatsby themes are composable means that you can install multiple themes in a single Gatsby site in much the same way you…
-
Using a Theme in an Existing Site
As you saw in the previous section, while it’s perfectly feasible to spin up a new Gatsby site based on a theme thanks to theme starters, it’s often the case that you already have a Gatsby implementation in progress that can’t benefit from a theme starter. In this scenario, you’ll need to install a theme into…
-
Starting a New Site from a Theme
The fastest way to use an existing theme to spin up a new Gatsby site is to leverage a starter that is associated with the theme. For example, gatsby-starter-blog-theme, a Gatsby starter, is a theme starter for the gatsby-theme-blog theme. As opposed to a regular Gatsby starter, which we’ve seen multiple times throughout this app, a theme starter creates a new site that…
-
Using Gatsby Themes
If you’ve made the decision to use an existing Gatsby theme rather than creating one from scratch, you have a few options. You can either create a new site based on a theme, use a theme in an existing Gatsby site you’ve already implemented, or use multiple Gatsby themes in that site. We’ll cover each…
-
Deciding Between Using and Creating a Theme
Before we turn to the actual usage and creation of themes, it’s important to be able to make an educated decision about whether to leverage a preexisting theme that exists in the wider Gatsby ecosystem or to create a new theme from scratch. That decision making should include the following considerations: Consider using an existing theme…
-
Differences from Plugins and Starters
In terms of maintenance, plugins and themes differ considerably from starters in that they can be released and updated as normal packages. Because starters are often immediately updated and diverge considerably from the source once installed, it’s much more challenging to synchronize changes once they’ve begun to deviate in development. In fact, this limitation of starters was…
-
Gatsby Themes in Context
A theme in Gatsby is a special kind of plugin that contains its own gatsby-config.js and is responsible for providing prebuilt functionality, data sourced from external sources, and UI code. To create a Gatsby theme, all of the baseline default configuration (shared functionality, data sourcing, design elements, etc.) is abstracted out of a Gatsby site and converted into…