[Bug]: margin-top class not working with JIT enabled
What version of Tailwind CSS are you using?
v2.1.2
What build tool (or framework if it abstracts the build tool) are you using?
Next.js 10.2.0
What version of Node.js are you using?
v14.16.0
What browser are you using?
Chrome
What operating system are you using?
macOS
Reproduction repository
https://github.com/luciovilla/luciovilla.com/blob/main/layouts/BlogLayout.js#L11
Describe your issue
When enabling JIT, mt-{} does not work. If I disable it, all the margin-top classes work again. The repo provided renders this page which contains the mt-8 class but does not render the styles.
Hey! Your issue is that you have forgotten to add your layouts folder to your purge config here:
https://github.com/luciovilla/luciovilla.com/blob/main/tailwind.config.js#L5
So Tailwind is not scanning that layout file at all. Update it to this and you should be good to go:
const { fontFamily } = require('tailwindcss/defaultTheme')
module.exports = {
mode: 'jit',
purge: [
'./pages/**/*.js',
'./components/**/*.js',
'./layouts/**/*.js'
],
theme: {
fontFamily: {
body: ['Inter', ...fontFamily.sans],
sans: ['Inter', ...fontFamily.sans],
},
extend: {
colors: {
blue: '#01417b',
yellow: '#ffa70a',
},
},
},
}
Oh my, can't believe I missed that... Thank you @adamwathan!