Add Files using a Gatsby Recipe

Khaled Garbaya
InstructorKhaled Garbaya

Share this video with your friends

Send Tweet
Published 2 years ago
Updated 2 years ago

Often times packages will require their own bespoke configuration files apart from NPM installing and configuring in gatsby-config.js or you may want additional files present for doing things like setting global styles. We can handle this by creating files within a Gatsby Recipe.

In this lesson, we will create a handful of Files within a Gatsby Recipe to configure tailwindcss and postcss. We will also see how we can create an example usage of tailwind within gatsby as part of the recipe.

Khaled Garbaya: [0:00] Using Gatsby Recipes, you can also create files. To do that, let's create a new step and add here a description and use the file JSX component. We will type File. We'll give it a path. This one will be postcss.config.js and the content. The content can be a URL to some text content. I'm going to paste a link here. We close the component.

[0:38] I will add three more files. Then I will add a final step and add the description here. Let's save and go to our terminal and run the recipe again. Let me skip to the step that we need. Here, we can see the third step that we added, which is adding a few files. You can see here the diff and what will change. Let's hit enter. We're done.