Troubleshooting Missing Styles After Tailwind CSS and PostCSS Updates in a Vue Starter Pack
On a newly set up Vue Starter Pack, I initially encountered a PostCSS error after updating packages using ncu --upgrade followed by running npm install:
[vite:css] [postcss] It looks like you're trying to use tailwindcss directly as a PostCSS plugin. The PostCSS plugin has moved to a separate package, so to continue using Tailwind CSS with PostCSS you'll need to install @tailwindcss/postcss and update your PostCSS configuration.
To resolve this, I installed the PostCSS package with npm install -D @tailwindcss/postcss and updated the Tailwind import in my vite.config.js file to import tailwindcss from '@tailwindcss/postcss';. I also updated the css configuration as follows:
css: { postcss: { plugins: [ tailwindcss(), autoprefixer, ], }, },
Subsequently, running npm run build again resulted in this error:
error during build: [vite:css] [postcss] Cannot apply unknown utility class: border-border file: C:/Users/bulent/Herd/kampanya/resources/css/app.css:undefined:NaN
To address this, I modified my app.css file to:
@layer base { * { border-color: hsl(var(--border)); /* Doğrudan CSS değişkeni kullanın */ }
body {
background-color: hsl(var(--background));
color: hsl(var(--foreground));
}
}
After these changes, the npm run build process completed successfully. However, when I viewed the site in the browser, no styles were loading.
Please or to participate in this conversation.
