Add a Gatsby Plugin using a Gatsbyjs Recipe

Khaled Garbaya
InstructorKhaled Garbaya
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 3 years ago

In Create a Custom Gatsbyjs Recipe for Installing NPM Packages you learned how to write a Gatsby Recipe to install an NPM Package. For gatsby plugins and themes, there is a config step as well.

In this lesson we will create a new step within a recipe that will install the gatsby-plugin-postcss package and configure it within gatsby-config.js using the GatsbyPlugin component. NOTE: Options support for configuring plugins coming soon.

Khaled Garbaya: [0:00] To add a Gatsby plugin, let's first create a new [inaudible] . Here we'll add a description. Let's install the NPMPackage over the plugin. Next, let's use the GatsbyPlugin component to configure Gatsby to use that plugin. We will give it a name. The name will be gatsby-plugin-postcss. Let's hit Save and run our recipe again.

[0:28] First step is installing Tailwind CSS. The second step is adding this gatsby-plugin-postcss. Now that's done, if we go to our gatsby-config.js, all the way down, you can see here we added that plugin. It's also installed as a dependency right here.

[1:03] In review, to add a GatsbyPlugin through recipe, you need to install it using the NPMPackage component, and then use the GatsbyPlugin component to add that to the Gatsby config.

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