Building an Example All Caps Plugin for Tailwind CSS
The first step is to import the
plugin function from
const plugin = require("tailwindcss/plugin")
Now we can call this function inside our
plugins array. This function gives us another function that allows us to access other functions such as
0:00 We'll need the plugin function from Tailwind CSS. The first thing I'll do here is const plugin and require tailwindcss/plugin. Then inside of my plugin's array here I can call this plugin function. This function actually gives me another function, which is where I can grab things such as addBase, addComponents, addUtilities. Here we want to add to the base layer, so I'll choose addBase.
0:43 That addBase function here is exactly what we're going to use to inject our theme styles -- our CSS variables that we've defined in the previous lessons.