AboutBlogContact
FrontendNovember 15, 2020 2 min read 16

Tailwind CSS JIT: Transforming Build Times and Workflow (2020)

AunimedaAunimeda
📋 Table of Contents

Tailwind CSS JIT: Transforming Build Times and Workflow

In 2020, if you are using Tailwind CSS, you know the pain: the development build is massive. Because Tailwind generates every possible utility class upfront, your browser's dev tools often choke on a multi-megabyte CSS file. We've been using PurgeCSS to clean it up for production, but the dev experience is still lagging.

Enter the Just-In-Time (JIT) engine. Instead of generating everything, it scans your HTML/JS files and generates only what you use, as you use it.

The Problem: Pre-generated Bloat

Previously, tailwind.config.js would look something like this:

module.exports = {
  purge: ['./src/**/*.html'],
  theme: {
    extend: {},
  },
  variants: {
    extend: {
      backgroundColor: ['active', 'group-hover'],
    },
  },
}

Every variant you added multiplied the CSS size exponentially.

The Solution: JIT Mode

With the new JIT engine (available as a preview in late 2020), you just flip a switch:

// tailwind.config.js
module.exports = {
  mode: 'jit',
  purge: [
    './public/**/*.html',
    './src/**/*.{js,jsx,ts,tsx,vue}',
  ],
  // ...
}

Dynamic Values

The coolest part of JIT is "Arbitrary Value Support." You are no longer limited to your theme's spacing or color scale. Need a very specific top offset?

<div class="top-[117px] bg-[#bada55] text-[22px]">
  Look Ma, no config!
</div>

Tailwind sees top-[117px] and instantly generates:

.top-\[117px\] {
  top: 117px;
}

Performance Metrics

In a typical large project:

  • Dev Build Size: From 8MB -> 10KB.
  • Build Speed: From 3-5 seconds -> 80ms.
  • Browser Performance: Inspector no longer hangs when toggling styles.

This is a game changer for 2021 and beyond. The constraint of "pre-defined scales" is effectively gone while maintaining the benefits of a utility-first framework.

Read Also

Zero-Runtime CSS-in-JS: The Performance King (2023)aunimeda
Frontend

Zero-Runtime CSS-in-JS: The Performance King (2023)

Is Styled Components dead? In 2023, zero-runtime CSS-in-JS is taking over. No more runtime script, no more style re-calculation.

Qwik: Resumability vs. Hydration (2022)aunimeda
Frontend

Qwik: Resumability vs. Hydration (2022)

Is the era of hydration over? In 2022, Misko Hevery's Qwik introduces 'resumability' to achieve instant-on web apps.

WebGL: High-Performance Data Visualization on the Web (2021)aunimeda
Frontend

WebGL: High-Performance Data Visualization on the Web (2021)

When SVG and Canvas 2D hit their limits, WebGL is the answer. In 2021, we are visualizing millions of data points with the GPU.

Need IT development for your business?

We build websites, mobile apps and AI solutions. Free consultation.

Get Consultation All articles