I have a /latest page in my pages directory which displays all the latest posts. But my Tailwind classes (grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-4) don't want to work. Here is a side by side comparison of the issue I'm having:
My component looks like this (./pages/latest.tsx):
const Latest: React.FC<LatestProps> = ({}) => {
const { t } = useTranslation('latest')
const { data, loading } = useFindLatestQuery()
return (
<>
<Navigation />
<DefaultWrapper>
<div className="w-full">
<div className="w-full flex justify-center">
<h1>{t('recent')}</h1>
</div>
{!loading && data?.posts?.length > 0 ? (
<div className="mt-6 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-4">
{[...data.posts].map((post, index) => (
<SearchedPost key={index} post={post as unknown as Post} />
))}
</div>
) : (
<p>Loading...</p>
)}
</div>
</DefaultWrapper>
</>
)
}
Here's a link to the production CSS generated by Tailwind, and you'll see that there's nothing related to grid. Here's also a link to that build.
Tailwind Config:
module.exports = {
// mode: 'jit',
purge: [
'./components/**/*.{js,jsx,ts,tsx}',
'./pages/**/*.{js,jsx,ts,tsx}',
'./icons/**/*.{js,jsx,ts,tsx}',
],
darkMode: 'class', // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}

