Exploring JIT mode in Tailwind CSS
Blog post from LogRocket
Tailwind CSS, a collection of opinionated CSS utility classes, introduces a new Just-in-Time (JIT) compiler from version 2.1, which dynamically generates styles on demand, enhancing productivity for developers. This JIT mode offers several advantages, such as eliminating the need for custom CSS by allowing the use of arbitrary values, significantly reducing build times, and enabling all variants by default without configuration. It also ensures that staging styles mirror production styles, eliminating the need to purge unused styles. The guide explores practical use cases of JIT, including implementing arbitrary values for pixel-perfect designs, utilizing pseudo-elements, and customizing per-side border colors. However, developers are cautioned against overusing arbitrary values, which might lead to inconsistencies, and advised on potential drawbacks due to the JIT mode's experimental nature. Installation involves updating the tailwind.config.js file to set the mode to 'jit,' and developers are encouraged to adopt JIT for faster, more streamlined, and scalable code.