In this episode, we're getting our project ready to look and feel great by setting up Tailwind CSS. We'll use Tailwind to easily style all of our components, and specifically pull in the Tailwind Forms plugin to help reset our form styles, since our app will have quite a few forms.
We start by heading over to the Tailwind documentation, and since our project uses both Laravel and Vite, we follow the Laravel instructions but make a couple of small tweaks. We'll install Tailwind via npm, generate a config file, and then set up the content
section so Tailwind can scan our Vue components for class names. A tip: if you notice Tailwind isn't picking up your classes, you might need to add more directories to the content
array.
Next, we pull Tailwind's base styles into our main CSS file, and because our build process is ready, we just have to re-run npm run dev
to see Tailwind in action. To make sure everything's working, we add a test input field to our homepage. At first, it's plain, but as soon as we bring in the Tailwind Forms plugin and require it in our config, our input gets a nice fresh look. That's how you know it's working!
With Tailwind and its plugins in place, we're all set up to start styling real parts of our app. We wrap up by previewing what's next: tackling navigation styling, which is a bit more involved. So if you're ready, let’s move onto that next!