--- title: Feature Announcement - Tailwind CSS support authors: [shayneczyzewski] image: /img/tailwind-2.png tags: [webdev, wasp, feature, css] --- import Link from '@docusaurus/Link'; import useBaseUrl from '@docusaurus/useBaseUrl'; import InBlogCta from './components/InBlogCta'; import WaspIntro from './_wasp-intro.md'; import ImgWithCaption from './components/ImgWithCaption'
Ok, it wasn’t a huge stretch for us to do so preemptively. Tailwind is one of the most heavily used CSS frameworks out there today and seems to keep growing in popularity. So how do you integrate it into your Wasp apps? Like many things in Wasp, it’s really easy- just drop in two config files into the root of your project and you can then start using it! Here are the defaults: ```jsx title="./tailwind.config.cjs" /** @type {import('tailwindcss').Config} */ module.exports = { content: [ "./src/**/*.{js,jsx,ts,tsx}", ], theme: { extend: {}, }, plugins: [], } ``` ```jsx title="./postcss.config.cjs" module.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, }, } ``` When these two files are present, Wasp will make sure all the required NPM dependencies get added, that [PostCSS](https://postcss.org/) plays nicely with Tailwind directives in CSS files, and that your JavaScript files are properly processed so you can use all the CSS selectors you want (provided you are properly equipped :D).
With that in place, you can add the Tailwind directives to your CSS files like so: ```css title="./src/client/Main.css" @tailwind base; @tailwind components; @tailwind utilities; /* rest of content below */ ``` And then start using Tailwind classes in your components: ```jsx