Skip to content
This repository was archived by the owner on Feb 14, 2022. It is now read-only.

Commit c3e3d35

Browse files
committed
Merge branch 'master' into upgrade
2 parents f65f450 + 962a2dd commit c3e3d35

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Loading
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { adamwathan } from '@/authors'
2+
import image from './card.jpg'
3+
4+
export const meta = {
5+
title: `Just-In-Time: The Next Generation of Tailwind CSS`,
6+
description: `One of the hardest constraints we've had to deal with as we've improved Tailwind CSS over the years is the generated file size in development. Today I'm super excited to share a new project that makes this constraint a thing of the past: a just-in-time compiler for Tailwind CSS.`,
7+
date: '2021-03-15T16:30:00.000Z',
8+
authors: [adamwathan],
9+
image,
10+
footer: `
11+
<p>
12+
Ready to try it out?
13+
<a href="https://github.com/tailwindlabs/tailwindcss-jit" class="font-medium text-teal-500 hover:text-teal-600">
14+
Get started →
15+
</a>
16+
</p>
17+
`,
18+
}
19+
20+
One of the hardest constraints we've had to deal with as we've improved Tailwind CSS over the years is the generated file size in development. With enough customizations to your config file, the generated CSS can reach 10mb or more, and there's only so much CSS that build tools and even the browser itself will comfortably tolerate.
21+
22+
For that reason, you've always had to be careful about expensive changes to your config file like adding too many extra breakpoints or enabling extra variants like `disabled` or `focus-visible`.
23+
24+
Today I'm super excited to share a new project we've been working on that makes these considerations a thing of the past: [**a just-in-time compiler for Tailwind CSS**](https://github.com/tailwindlabs/tailwindcss-jit).
25+
26+
<!--more-->
27+
28+
<div className="relative pb-9/16 my-12">
29+
<iframe
30+
className="absolute inset-0 h-full w-full"
31+
src="https://www.youtube.com/embed/3O_3X7InOw8"
32+
frameBorder="0"
33+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
34+
allowFullScreen
35+
></iframe>
36+
</div>
37+
38+
[**@tailwindcss/jit**](https://github.com/tailwindlabs/tailwindcss-jit) is a new experimental library that compiles all of your CSS _on-demand_ as you author your template files, instead of generating your entire stylesheet up front.
39+
40+
This comes with a lot of advantages:
41+
42+
- **Lightning fast build times**. Tailwind can take 3–8s to initially compile using our CLI, and upwards of 30–45s in webpack projects because webpack struggles with large CSS files. This library can compile even the biggest projects in about 800ms _(with incremental rebuilds as fast as 3ms)_, no matter what build tool you're using.
43+
- **Every variant is enabled out of the box**. Variants like `focus-visible`, `active`, `disabled`, and others are not normally enabled by default due to file-size considerations. Since this library generates styles on demand, you can use any variant you want, whenever you want. You can even stack them like `sm:hover:active:disabled:opacity-75`. Never configure your variants again.
44+
- **Generate arbitrary styles without writing custom CSS.** Ever needed some ultra-specific value that wasn't part of your design system, like `top: -113px` for a quirky background image? Since styles are generated on demand, you can just generate a utility for this as needed using square bracket notation like `top-[-113px]`. Works with variants too, like `md:top-[-113px]`.
45+
- **Your CSS is identical in development and production**. Since styles are generated as they are needed, you don't need to purge unused styles for production, which means you see the exact same CSS in all environments. Never worry about accidentally purging an important style in production again.
46+
- **Better browser performance in development**. Since development builds are as small as production builds, the browser doesn't have to parse and manage multiple megabytes of pre-generated CSS. In projects with heavily extended configurations this makes dev tools a lot more responsive.
47+
48+
Try it today by installing `@tailwindcss/jit` and swapping it into your PostCSS configuration:
49+
50+
```shell
51+
npm install -D @tailwindcss/jit tailwindcss postcss autoprefixer
52+
```
53+
54+
```js
55+
// postcss.config.js
56+
module.exports = {
57+
plugins: {
58+
'@tailwindcss/jit': {},
59+
autoprefixer: {},
60+
}
61+
}
62+
```
63+
64+
We're shipping it as a separate library for now, but once we've worked out all the kinks we're going to roll it right back into `tailwindcss` behind a configuration option, and we're aiming to make it the default in Tailwind CSS v3.0 later this year.
65+
66+
[Learn more about the project on GitHub](https://github.com/tailwindlabs/tailwindcss-jit), then install it, play with it, bend it, break it, and let us know what you think!

0 commit comments

Comments
 (0)