tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

[Bug]: margin-top class not working with JIT enabled

Open luciovilla opened this issue 5 years ago • 2 comments

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.

luciovilla avatar May 23 '21 19:05 luciovilla

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',
      },
    },
  },
}

adamwathan avatar May 23 '21 20:05 adamwathan

Oh my, can't believe I missed that... Thank you @adamwathan!

luciovilla avatar May 24 '21 17:05 luciovilla