vue.jstailwind-cssvite

How do I add tailwindcss to vite?


I'm using vite 0.16.6 and wanted to migrated a vuepress site to using vite.

However I was unsure how to configure vite to using tailwindcss.

in my index.css

@tailwind base;
@tailwind components;
@tailwind utilities;

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}

Solution

  • After some digging, looks like that we have to include a postcss.config.js in the root directory of the application

    module.exports = {
      plugins: [
        // ...
        require('tailwindcss'),
        require('autoprefixer'),
        // ...
      ]
    }