Understanding Just-In-Time (JIT) Mode for Tailwind CSS

The Power and Flexibility of Just-In-Time Mode in Tailwind CSS

Patrick Karsh
4 min readJun 29, 2023
The wind in the sails of the boat having to do all this frontend engineering will buy me

As the field of web development evolves, developers are constantly searching for more efficient ways to work. One of the groundbreaking solutions in this landscape is Tailwind CSS, a utility-first CSS framework that has gained immense popularity among developers for its high customizability and ease of use. In particular, its Just-In-Time (JIT) mode has garnered widespread attention due to the vast improvements it brings to development workflow and performance. This article delves into the nuts and bolts of JIT Mode in Tailwind CSS and discusses its transformative effect on web development.


  • Just-In-Time (JIT) mode in Tailwind CSS dynamically generates styles as needed, resulting in optimized CSS files and significantly reduced file sizes, often by over 95%.
  • This feature allows for greater design freedom with classes of any arbitrary value and improves development speed, while also supporting pseudo-class variants and introducing additional flexibility features such as arbitrary value support, dark mode, and important modifier.
  • Despite its many advantages, JIT mode may not suit all projects or developers as it requires running continuously during development and necessitates the setup of a build tool that supports PostCSS.

First, it’s essential to understand what the JIT mode is. JIT, short for Just-In-Time, is a term borrowed from the manufacturing industry where it refers to a method aimed at reducing flow times within production systems. In Tailwind CSS, JIT mode takes a similar approach by dynamically generating styles when they are needed rather than generating all possible styles at build time.

The JIT mode in Tailwind CSS works by parsing your templates on-demand to find the utilities you use. Then it generates the corresponding CSS directly. This efficient technique contrasts with the traditional method of generating a large set of pre-defined classes up front, most of which are never used. This intelligent process reduces the outputted CSS to only what is needed and eliminates redundant CSS classes, leading to smaller and faster style sheets.

In practice, the JIT compiler scans your project files to find where you’ve used Tailwind CSS classes. This process includes HTML files, Vue, React, JSX files, and even CSS files with @apply directives. The compiler then produces an optimized CSS file containing only the classes you’ve actually used in your project, significantly reducing file size.

JIT mode’s on-demand approach has several key benefits. Firstly, it massively reduces the size of the resulting CSS. Traditional Tailwind CSS generates thousands of utility classes, resulting in a substantial CSS file. With JIT, only used styles are generated, typically reducing CSS size by over 95%.

The second benefit is the uncapped, direct style application. In the standard mode, Tailwind CSS is constrained to a predefined set of utility classes. With JIT, you can create classes with any arbitrary value you need. This could be specific widths, colors, or font-sizes that aren’t part of Tailwind’s default configuration. This allows for greater design freedom without bloating your CSS with unnecessary classes.

Thirdly, JIT mode improves development speed. The removal of redundant classes results in smaller CSS files, which in turn reduces build times and refreshes the browser faster during development. This increased speed can greatly enhance developer experience and productivity.

There are also additional developer experience improvements. The JIT mode supports pseudo-class variants like hover, focus, active, and many others for all utilities, without the need for configuration. Moreover, it also introduces new features like arbitrary value support, dark mode, and important modifier, offering more flexibility for developers.

However, despite its many advantages, the JIT mode does have some considerations. Due to the dynamic nature of JIT, it needs to run continuously in the background during development, which can lead to an increased demand on system resources. Moreover, it requires the setup of a build tool that supports PostCSS, which may not be suitable for all projects.

In conclusion, the JIT mode in Tailwind CSS represents a paradigm shift in the way developers work with CSS. Its focus on generating only what’s necessary leads to smaller, faster, and more efficient style sheets. It combines the best of low-level and high-level styling approaches, offering both flexibility and performance. While it may not be suited for every project or developer, its unique benefits undoubtedly make it a compelling option for many. As web development continues to evolve, techniques like JIT mode in Tail

wind CSS will continue to push the boundaries of what’s possible, driving the industry towards a more efficient and productive future.



Patrick Karsh

NYC-based Ruby on Rails and Javascript Engineer leveraging AI to explore Engineering. https://linktr.ee/patrickkarsh