I've already specified .tsx files in my tailwind config file, but the tailwind classes only worked in .astro files unless I put the same class anywhere on my BaseLayout.astro, then it will work only for that specific class. But then if I delete the class in my layout, the class in the .tsx files still works.
tailwind.config.mts:
export default {
content: ["./src/**/*.{astro, tsx}"],
};
index.astro:
---
import BaseLayout from "@layouts/BaseLayout.astro";
---
<BaseLayout>
<p class="text-red-600">Landing</p>
</BaseLayout>
BaseLayout.astro:
---
import BaseHead from "@components/BaseHead";
import Navbar from "@components/Navbar";
---
<html>
<BaseHead pageName="Landing" />
<body className="text-blue-600">
<Navbar />
<slot />
</body>
</html>
Navbar.tsx: (the text-blue-600 only works if I also put the same class on the layout anywhere.)
export default function Navbar() {
return (
<header>
<h1 className="text-blue-600">BRAND</h1>
</header>
);
}