Based on the knowledge sources, it appears you're experiencing an issue with Tailwind CSS classes not applying consistently across your Nuxt application with Nuxt UI v2.20.
When using Nuxt UI, Tailwind CSS is included as a dependency, so you don't need to install it separately. However, there are a few things to check to ensure Tailwind classes work properly throughout your application:
- CSS Import Order: Make sure you're importing Tailwind CSS and Nuxt UI in the correct order in your CSS file:
@import "tailwindcss";
@import "@nuxt/ui";
- Content Detection: Tailwind CSS needs to know which files to scan for classes. If you're using Tailwind classes in files that aren't automatically detected, you might need to use the
@source directive in your CSS file:
@import "tailwindcss";
@import "@nuxt/ui";
@source "../../../content";
@source "../../content";
- VSCode Configuration: For better development experience, install the Tailwind CSS IntelliSense extension and add these settings to your
.vscode/settings.json:
"files.associations": {
"*.css": "tailwindcss"
},
"editor.quickSuggestions": {
"strings": "on"
},
"tailwindCSS.classAttributes": ["class", "ui"],
"tailwindCSS.experimental.classRegex": [
["ui:\\s*{([^)]*)\\s*}", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
]
- App Wrapper: Ensure your app is wrapped with the
UApp component, which provides global configurations:
<template>
<UApp>
<NuxtPage />
</UApp>
</template>