A Gatsby plugin is a Node package that uses the Gatsby APIs under the hood.
You can use a plugin to source data into your site, transform content or enhance the output of your site like adding google analytics etc...
Gatsby plugins can be categorized into 3 types:
Install a plugin you can run the command npm install plugin-name
e.g npm install gatsby-plugin-postcss
.
Add the plugin to your gatsby-config.js
file
In this lesson, you learn how to use gatsby-plugin-postcss to add tailwindcss support to your project
Instructor: [0:00] First, let's install tailwindcss as a dev dependency. After that, we need to install the gatsby-plugin-postcss. Let's go to our project and create a gatsby-config.js. In there, let's add our new plugin. Next, let's create a postcss.config.js file and add tailwind as a plugin.
[0:40] Finally, inside of src, let's create a CSS folder. Inside of that, let's create an index.css file. Let's add the tailwind base. Let's go to our components inside the flyout. Since this is used in every page, we can import our CSS in here.
[0:58] Here we will simply import the index.css file. Let's hit Save and run our server. You can see here, the CSS has changed and this is using tailwind.