This guide will show you how to install and utilize Tailwind CSS and Sass in your Nuxt 3 project.
Before getting started, please make sure you have set up a new project as mentioned here 👉 Nuxt3 Project.
Install all the dependencies by typing the following commands in your terminal: 💻
npm install -D @nuxtjs/tailwindcss postcss@latest autoprefixer@latest
sass-loader node-sass sass.
npx tailwindcss init
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'@@/components/**/*.{js,vue,ts}',
'@@/iayouts/**/*.vue',
'@@/pages/**/*.vue',
'@@/nuxt.config.{js,ts}'
],
theme: {
extend: {},
},
plugins: [],
}
export default defineNuxtConfig({
modules: ['@nuxtjs/tailwindcss'],
css: ['@@/assets/css/base.scss'], <-- "feel free to rename it"
plugins: [
],
postcss: {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
}
})
npm run dev