⚠️ This lesson is retired and might contain outdated information.

Use the Gatsby Theme Workspace Starter to Begin Building a New Theme

Amberley Romo
InstructorAmberley Romo
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 2 years ago

Yarn workspaces are a great way to set up a project for theme development because they support housing multiple packages in a single parent directory and link them together.

This video will teach you:

  • How to use the Gatsby theme workspace starter to quickly set up a workspace to build a new Gatsby theme.

Further reading

Instructor: [0:00] Set up a Yarn Workspace to build a new Gatsby theme using the Gatsby theme workspace starter. We'll copy the link to the starter and over in our terminal, run "Gatsby new, my theme workspace," and then the link to the starter.

[0:18] Then, CD into "my theme workspace," and open it up in your code editor. We have two directories, "Gatsby theme minimal" and "example." It's packaged at JSON here in the route. The route packaged at JSON sets up the Yarn Workspace.

[0:34] Here, we have "Gatsby theme minimal" and "example." These names correspond to the names defined in each project packaged at JSON, not the name of the directory. Back over in our terminal, if we run "Yarn Workspace's info," we'll see these workspaces that we've set up.

[0:56] Back over in our code, Gatsby-theme-minimal is the most minimal possible Gatsby theme. It defines a Gatsby config and also marks Gatsby as a peer dependency.

[1:07] Example is the minimal Gatsby site that does nothing but install and use gatsby-theme-minimal. Here, we're installing gatsby-theme-minimal and using it in our Gatsby config.

[1:20] Taking a look back at yarn workspaces info, we can see that gatsby-theme-minimal is a workspace dependency of example. Run the example site by using yarn workspace example develop.

[1:35] This command says run yarn. Target the workspace of example, and run the develop script.

[1:44] The example site is running. We're ready to start developing a new theme.

egghead
egghead
~ 4 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