I wanted to implement multilanguage support with next-intl and I changed my file structure like this:
app/
favicon.ico
globals.css
[locale]/
layout.tsx
page.tsx
(root)/
services/
page.tsx
gallery/
page.tsx
reviews/
page.tsx
In my layout.tsx I do import the globals.css like: import "../globals.css"
For some reason, it doesnt apply Tailwind to any of my pages. Maybe I'm doing something wrong, I don't know. I'm new to Next. Im using [email protected]
Here is my postcss.config.js:
module.exports = {
plugins: {
'@tailwindcss/postcss': {},
autoprefixer: {}
}
}
And my tailwind.config.ts:
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./app/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
'./pages/**/*.{js,ts,jsx,tsx}',
'./public/**/*.{html,js}'],
theme: {
extend: {
fontFamily: {
kollektiv: ['Kollektif', 'sans-serif'],
},
animation: {
'border-pulse-red': 'borderPulseRed 1.5s infinite',
},
keyframes: {
borderPulseRed: {
'0%, 100%': { borderColor: '#fee2e2' },
'50%': { borderColor: '#ef4444' },
},
},
},
},
plugins: [],
};
Also here is my globals.css:
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer utilities {
.dark {
@apply dark:bg-background dark:text-foreground;
}
.dark * {
@apply dark:border-border dark:outline-ring/50;
}
.navbar_ul {
@apply flex items-center gap-6 ml-6 text-lg font-semibold text-gray-700 transition-all duration-500;
}
.footer_section {
@apply flex items-center justify-around gap-4 px-2 py-4 bg-[#1E1E1E];
}
.animate-float {
animation: float 4s ease-in-out infinite;
}
@keyframes float {
0%, 100% {
transform: translateY(0px);
}
50% {
transform: translateY(-10px);
}
}
.link-hover-effect {
color: #d1d5db; /* Tailwind's text-gray-300 */
transition-property: color, transform, text-decoration;
transition-duration: 300ms;
}
.link-hover-effect:hover {
color: #fff; /* Tailwind's text-white */
text-decoration: underline;
text-underline-offset: 4px;
transform: scale(1.05);
}
.nav-underline {
@apply relative cursor-pointer;
}
.nav-underline::after {
content: '';
position: absolute;
bottom: -4px;
left: 0;
width: 100%;
height: 2px;
background: linear-gradient(to right, #0d9488, #2563eb); /* teal-600 to blue-600 */
transform: scaleX(0);
transform-origin: left;
transition: transform 0.3s ease;
}
.nav-underline:hover::after {
transform: scaleX(1);
}
.navbar_ul > li {
@apply relative cursor-pointer;
}
.navbar_ul > li::after {
content: '';
display: block;
height: 2px;
background-color: #60a5fa;
transform: scaleX(0);
transition: transform 0.3s;
transform-origin: left;
}
.navbar_ul > li:hover::after {
transform: scaleX(1);
}
}
@layer base {
* {
@apply border-border outline-ring/50;
}
body {
@apply bg-background text-foreground;
}
}
Let me know if you need any other files for reference. Thank you in advance!
I tried to add multilanguage support and I had to change the file structure and add my app files under [locale] folder and now my tailwind doesnt apply to any of my pages. The next-intl does work fine, I tried to change it on the messed up page that I had.