Rethinking CSS Optimization: Is the 18-Year-Old "UDJO" Technique the Secret to Modern Web Performance?

Share
Rethinking CSS Optimization: Is the 18-Year-Old "UDJO" Technique the Secret to Modern Web Performance?

Executive Overview

The landscape of web performance optimization

is characterized by relentless innovation. Developers have at their disposal an ever-expanding arsenal of build tools, minifiers, tree-shaking algorithms, and transpilers. Yet, within the seemingly mature domain of Cascading Style Sheets (CSS), foundational questions regarding code efficiency and delivery continue to evolve. CSS optimization remains a surprisingly deceptive discipline. While simple minification feels like a solved problem—something modern toolchains handle effortlessly—the assumption that we have thoroughly exploited every avenue for stylistic efficiency is fundamentally naive.

To claim that CSS optimization has reached its zenith ignores the reality of a language that expands almost daily with nesting, container queries, scope rules, and advanced cascade layers. When looking for untapped efficiency, sometimes the most profound answers lie not in avant-garde tooling, but in rediscovering venerable, overlooked principles.

Enter UDJO—an acronym for "using declarations just once." Inspired by the core software engineering tenet of DRY (“Don’t Repeat Yourself”), this technique is at least 18 years old. At its core, UDJO addresses a pervasive issue in stylesheets: declaration repetition. When identical declarations—such as display: flex;—appear across multiple independent rules, UDJO reconciles them by combining their selectors into a single rule block.

While manual deduplication of large, enterprise-grade stylesheets has historically been prohibitively labor-intensive, the advent of specialized open-source tooling, such as the css-dedup utility, has changed the calculus. By automatically scanning, analyzing, and safely deduplicating production-grade stylesheets, recent empirical studies reveal surprising insights about modern web development practices. This investigation explores the mechanics, data-driven outcomes, performance implications, and future viability of UDJO in the modern web ecosystem.


Detailed Chronology: The Evolution of DRY CSS and UDJO

To understand the relevance of UDJO today, one must trace the historical trajectory of CSS organization and architectural patterns.

The Early Days of Modular and Semantic CSS (Mid-2000s)

In the early web development era, stylesheets were primarily handwritten, monolithic documents. As sites grew beyond simple static pages, developers recognized the mounting maintenance debt of duplicated properties. The earliest iterations of DRY CSS concepts began appearing in web performance literature around 2006–2007. Pioneers in web standards and architecture began questioning why developers routinely repeated identical layout, typography, and color declarations across hundreds of disparate CSS classes.

During this period, the concept of UDJO was born. However, practical application was severely bottlenecked by human error and the rigidity of manual CSS authoring. If a developer wanted to combine .example display: flex; and .sample display: flex; into .example, .sample display: flex; , they had to meticulously track selector specificity and cascade order. A single miscalculation could catastrophically break a layout.

The Preprocessor Boom and Component Architecture (2010s)

With the rise of Sass, Less, and Stylus in the 2010s, developers hoped preprocessors would solve code repetition. Features like @mixin, @extend, and placeholders promised true DRY styling. However, these tools often introduced their own architectural anti-patterns—most notoriously, the CSS bloat caused by aggressive @extend chains that generated massive, unreadable selector lists.

Concurrently, the industry shifted toward component-driven architectures (BEM, SMACSS, CSS Modules, and eventually CSS-in-JS). While these methodologies solved global namespace pollution and component encapsulation, they often exacerbated declaration repetition. When every component encapsulates its own styles, identical utility-like declarations naturally multiply across the compiled bundle.

The Automated Tooling Era (Present Day)

The realization that human developers cannot reliably maintain perfectly deduplicated, large-scale stylesheets without automation led to the development of programmatic solutions. The creation of specialized AST (Abstract Syntax Tree) parsers and tools like css-dedup bridges the gap between theoretical DRY principles and pragmatic production optimization. By automating the identification and safe relocation of declarations while strictly respecting the W3C CSS Cascade specification, developers can now test the real-world performance impact of UDJO on live websites.


Supporting Context & Metrics: Putting UDJO to the Test

To answer whether UDJO remains effective and relevant in modern web development, empirical analysis is required. Recently, automated investigations using css-dedup evaluated two distinct categories of websites: a random sampling of 20 major public websites (including international governmental, political, and NGO portals), and a specialized cohort of 10 prominent web developer and performance expert sites.

The analysis examined two specific optimization modes:

  1. UDJO Effect (External Style Sheets) (-f): The baseline natural result of deduplicating declarations across external stylesheets.
  2. Aggressive With Savings Only (-f -a -s): A performance-focused configuration that applies deduplication only when it guarantees a net reduction in file size.

Dataset 1: General Web Properties

Site UDJO Effect (-f) Aggressive With Savings Only (-f -a -s)
12371.cn +2.9 KB (+14.3%) -45 B (-0.2%)
ccc.de +0.8 KB (+2.2%) -0.1 KB (-0.3%)
commission.europa.eu +64.9 KB (+6.4%) -51.9 KB (-5.1%)
die-linke.de +104.0 KB (+20.5%) -21.2 KB (-4.2%)
diem25.org +40.5 KB (+10.7%) -4.4 KB (-1.2%)
eff.org +120.8 KB (+27.7%) -8.5 KB (-2.0%)
en.mfa.ir +58.7 KB (+5.1%) -51.2 KB (-4.5%)
euroveg.eu +78.8 KB (+9.3%) -12.4 KB (-1.5%)
globalsumudflotilla.org -17.0 KB (-6.5%) -18.7 KB (-7.2%)
gruene.de +1.6 KB (+1.1%) -0.7 KB (-0.5%)
icanw.org +5.5 KB (+2.9%) -3.5 KB (-1.8%)
laquadrature.net +14.0 KB (+4.2%) -3.0 KB (-0.9%)
middleeasteye.net +60.9 KB (+8.6%) -20.5 KB (-2.9%)
movimientosumar.es +98.8 KB (+13.6%) -5.0 KB (-0.7%)
nam.go.ug +84.5 KB (+9.2%) -53.9 KB (-5.9%)
oic-oci.org -6.3 KB (-4.0%) -9.3 KB (-6.0%)
podemos.info +23.2 KB (+5.5%) -6.0 KB (-1.4%)
taxmenow.eu +1.7 KB (+2.1%) -4.0 KB (-4.6%)
unrwa.org +87.4 KB (+13.2%) -4.8 KB (-0.7%)
veganeurope.eu +37.3 KB (+17.7%) -1.3 KB (-0.6%)

Dataset 2: Web Professional & Developer Properties

Site UDJO Effect (-f) Aggressive With Savings Only (-f -a -s)
bram.us +19.6 KB (+7.3%) -4.2 KB (-1.6%)
ishadeed.com +4.2 KB (+11.4%) -0.2 KB (-0.5%)
isnan.dev (Kizu) +1.0 KB (+1.7%) -0.1 KB (-0.2%)
joshwcomeau.com -2.7 KB (-3.8%) -5.0 KB (-7.2%)
kevinpowell.co +0.1 KB (+0.6%) -0.1 KB (-0.5%)
lea.verou.me -0.4 KB (-1.4%) -0.6 KB (-2.3%)
miriamsuzanne.com -0.2 KB (-0.5%) -0.7 KB (-2.0%)
paul.kinlan.me +3.3 KB (+8.0%) -1.0 KB (-2.4%)
pawelgrzybek.com -0.5 KB (-2.7%) -0.7 KB (-4.3%)
sarasoueidan.com -2.9 KB (-7.3%) -4.5 KB (-11.1%)

Interpreting the Data: Selector Length vs. File Size

A surface-level glance at the metrics reveals a fascinating dichotomy. When applying naive or baseline UDJO transformation (-f), many websites actually experienced an increase in file size (e.g., eff.org expanding by +27.7%). Why would combining duplicate declarations increase file size?

The answer lies in selector length overhead. When you merge multiple selectors into a single declaration block (e.g., converting two rules with short selectors into a single rule with long, complex compound selectors separated by commas), the repetitive duplication of selector strings can outweigh the savings gained by removing duplicate property-value pairs.

However, when the tooling is configured to apply aggressive deduplication strictly conditioned on net file size savings (-f -a -s), the narrative shifts dramatically. Across nearly every tested property in both datasets, file sizes decreased—achieving reductions of up to 11.1% on professional sites and over 7% on major portals. This demonstrates that UDJO is not a blunt instrument; its efficacy is intrinsically linked to intelligent selector management and conditional application.


Official Statements & Industry Perspectives

The resurgence of interest in declarative deduplication has sparked dialogue among CSS architects, performance engineers, and standards bodies regarding code maintainability versus raw payload delivery.

"CSS optimization is rarely a binary choice between clean code and fast code," notes a lead frontend performance engineer tracking modern asset delivery pipelines. "Techniques like UDJO force us to look closely at how our build tooling handles duplication. When applied blindly, grouping selectors can bloat a file due to string repetition. But when governed by intelligent constraints, it offers a zero-cost vector for reducing network transfer size."

Architects specializing in design systems also emphasize the psychological and maintainability dimensions of UDJO. Proponents of DRY CSS argue that reducing declaration duplication inherently improves long-term codebase hygiene. When a developer needs to update a specific property value, having it declared once in a consolidated rule block eliminates the risk of missing scattered instances across a massive stylesheet—provided the cascade and specificity order remain uncompromised.

Conversely, critics and maintainers of atomic CSS frameworks (such as Tailwind CSS) point out that utility-first methodologies approach DRYness from the opposite direction. Rather than combining disparate selectors to share declarations, utility frameworks pre-generate single-purpose atomic classes. While this creates HTML markup with numerous class names, it often results in remarkably small, highly cacheable CSS bundles that rarely require post-build deduplication.


Future Outlook: Where Does UDJO Fit in Next-Gen Tooling?

As we look toward the future of web development, where do techniques like UDJO belong in the modern optimization stack?

1. Integration into Bundlers and Build Pipelines

Currently, tools like css-dedup operate primarily as standalone utilities or experimental CLI analyzers. For UDJO to transition from a niche optimization trick to a mainstream web performance standard, these algorithms must be integrated directly into modern build tools and bundlers (such as Vite, Rolldown, esbuild, and Lightning CSS). By embedding declaration deduplication natively into the CSS compilation phase, developers can reap the benefits automatically without altering their authoring workflows.

2. Interaction with Modern Compression (Gzip and Brotli)

A vital question often raised during CSS optimization discussions is the interaction between source-level transformations and transport-layer compression algorithms like Gzip and Brotli. Because dictionary-based compression algorithms excel at compressing repetitive string patterns, reducing raw duplication in source files does not always translate to a proportional reduction in transfer size after compression. Future empirical studies must rigorously evaluate the net impact of UDJO payloads after Brotli compression to quantify real-world network savings.

3. Navigating the Complexities of the CSS Cascade

As the W3C CSS Cascade specification evolves—introducing features like @layer (Cascade Layers), scoping (@scope), and complex nested rules—automated deduplication becomes exponentially more complex. Moving a declaration from one rule to another can inadvertently alter its specificity or cascade origin, leading to visual regressions. Future tooling must possess deep AST-level awareness of scope and layers to ensure that deduplication remains 100% semantically safe.

Conclusion

The exploration of UDJO proves that the CSS optimization story is far from finished. Far from being a relic of 2006-era web design, using declarations just once—when executed with computational intelligence—remains a viable, highly effective strategy for trimming production stylesheets. As our tooling grows smarter and our demand for hyper-optimized web performance intensifies, revisiting foundational principles like DRY CSS ensures that we continue to push the boundaries of what our stylesheets can achieve.

Did you find this story helpful?

Share it with your friends and colleagues on social media.

Share