Setup a Gatsby Project to Use Recipes

Khaled Garbaya
InstructorKhaled Garbaya
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 3 years ago

Gatsby Recipes are a new tool of the gatsby-cli which require the latest install of the package. You will need to install the cli with npm install -g gatsby-cli@latest

Gatsby Recipes allow you to add common functionality to your Gatsby site with none of the headache of dealing with all the various plugins that would are required.

In this lesson, you will see how easy it is to install and run Jest with an official Gatsby recipe. What used to be a multiple step process (including modifying babel configs) is now a simple install command away.

Khaled Garbaya: [0:00] I have here an existing Gatsby project. To use Gatsby recipes, I need to upgrade some dependencies. To do that, we need to run yarn upgrade --latest. We need also to install the latest Gatsby CLI. To test this, we need to run gatsby recipes, and we should be able to see all the lists of the official recipes.

[0:24] To use one of them, we just go through the list, and pick one and hit Enter. You can see here it's showing us some instructions and telling us to press Enter. Let's press Enter. First thing this recipe will do is to install the Jest dependency. Let's do that.

[0:44] Now it's telling us that the recipe will create an example file. Here, we can see what will change. Since this is a new file, it's all addition. Let's hit Enter. The last step is to add an npm script to our package.json. You can see here the new added one. We hit Enter. You can see here that the recipe is run.

[1:12] If we do npm test, you can see that Jest is running, and our project is configured to use Jest.

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