Technology News

“Just in Time” CSS

I believe acss.io is the first usage of “Atomic CSS” where the point of it is to be a compiler. You write CSS like this:

<div class="C(#fff) P(20px)"> text
</div>

And it will generate CSS like:

.C(#333) { color: #333;
}
.P(20px) { padding: 20px;
}

(Or something like that.)

The point is that it only generates the CSS that you actually need, because you asked for it, and no more. The result is far less CSS than you’d see in an average stylesheet.

That complication process is what has come to be known as “Just in Time” CSS.

The popular Tailwind framework supports it. It kind of flips the mental model of Tailwind on its head, to me. Rather than providing a huge pile of CSS utility classes to use — then “purging” what is unused — it only creates what it needs to begin with.

I’d say “Just in Time” is a concept that is catching on. I just saw Assembler CSS and it leans into it big time. Rather than classes, you do stuff like:

<div x-style="grid; gap:1rem; grid-rows:1; grid-cols:1; sm|grid-cols:3"> <button x-style="^button:red">Submit</button>
</div>

I’m pretty torn on this stuff. Some part of me likes how you can get styling done without ever leaving your templates. And I especially like the extremely minimal CSS output since CSS is a blocking resource. Another part of me doesn’t like that it’s a limited abstraction of CSS itself, so you’re at the mercy of the tool to support things that CSS can do natively. It also makes HTML a bit harder to look at — although I certainly got over that with JSX inline event handlers and such.

Epic’s win over Apple is actually an Apple victory
3 methodologies for automated video game highlight detection and capture

Related Articles

What’s happening in venture law in 2021?

whats-happening-in-venture-law-in-2021
The venture world is growing faster than ever, with more funding rounds, bigger funding rounds, and higher valuations than pretty much any point in history. That’s led to an exponential…

Interpolating Numeric CSS Variables

Interpolating Numeric CSS Variables
We can make variables in CSS pretty easily: :root { --scale: 1; } And we can declare them on any element: .thing { transform: scale(var(--scale)); } Even better for an…

A New Home for WordPress Education Programs

A New Home for WordPress Education Programs
Over the past few weeks, a new space has taken shape on WordPress.org for students who want to learn, build, and contribute. WordPress Education programs bring together initiatives that help…

How Do Business Loan Rates Work? Our Complete Guide

how-do-business-loan-rates-work-our-complete-guide
Business loans are fund support for startups, business expansion, premises extension, office equipment, and furniture. You need to consider several things for affordable business loans to get a capital cushion…

CSS Hell

css-hell
There is a life beyond pixels and percentages. Using px units is fine in certain cases, the real mistake is using absolute instead of relative units. p {font-size: 16px;line-height: 20px;margin-bottom:…