Skip to content
WEB DEVELOPMENT & PROGRAMMING

Is UDJO Still Relevant? Reassessing an 18-Year-Old CSS Optimization Technique in Modern Web Development

CSS optimization remains a deceptively complex landscape in modern web development. On the surface, it feels like a solved problem—a routine task handled effortlessly by contemporary tooling, especially when it comes to standard minification. Yet, the assumption that the industry has fully exploited every possible avenue for CSS optimization can be viewed as naive. Such a claim is inherently difficult to defend for a language that continues to evolve almost daily, introducing powerful new features, logical properties, and architectural paradigms at a rapid pace.

To explore this ongoing evolution, developers often look back at foundational concepts to see how they hold up against modern standards. One such technique is UDJO, an acronym for "using declarations just once," which has been part of the optimization discourse for at least 18 years. While older sources and discussions may trace its roots even further back, the core principle remains tied to a fundamental tenet of software engineering: the DRY principle, or "don’t repeat yourself." UDJO operates by identifying and reducing, if not entirely eliminating, declaration repetition across style sheets.

The mechanics of the technique are straightforward in theory. If a declaration such as display: flex appears two or more separate times within a code base, the technique reconciles them into a single consolidated rule. Instead of maintaining independent blocks for different classes, the selectors are grouped together to share the identical declaration. While this approach appears intuitive, the actual outcome depends heavily on how intelligently the deduplication is executed and the length of the selectors involved. Intelligence determines whether UDJO delivers a genuine maintainability advantage—ensuring that a future change to a declaration can safely apply to all attached selectors without unintended side effects. Meanwhile, selector length directly influences how significant the resulting file size savings will be.

For developers seeking a deeper dive into the mechanics, historical discussions on DRY CSS outline the operational framework. However, a central question persists in contemporary development: Is UDJO still effective and relevant today?

Attempting to answer this question reveals a significant operational hurdle. When dealing with complex modern websites whose style sheet declarations have not been systematically deduplicated from the ground up, implementing UDJO manually requires an immense amount of time and effort.

To bypass this bottleneck and test the hypothesis efficiently, custom tooling can be developed to automate the process. While an automated tool might not immediately match the nuanced, context-aware decisions of a developer manually reviewing style sheets line by line, it is realistic to build software capable of catching and optimizing clear instances of repetition.

This realization led to the creation of CSS Dedup, an open-source utility designed not only to identify repetition but also to safely deduplicate code where optimizations are mathematically and structurally sound. Because deduplication inherently alters selector locations, it interacts directly with how the CSS cascade works under W3C specifications. Running such tools across real-world data provides concrete insights into the state of modern style sheets.

Is There Anything to Deduplicate in Modern CSS?

To evaluate the ongoing utility of the technique, a preliminary analysis was conducted across an arbitrary sample of twenty websites. Using CSS Dedup, the evaluation measured the projected file size changes under two distinct conditions: what would happen with a natural deduplication of provably safe changes, and what would happen under a more aggressive optimization strategy that only applied changes if they resulted in net file size savings.

These dual testing options provide a comprehensive view. The natural approach highlights the structural impact of removing redundancy, while the aggressive savings-only approach targets the metrics website owners care about most for performance: reduced transfer sizes. Because UDJO functions simultaneously as a maintainability and performance enhancement, examining both angles sheds light on its dual nature.

The findings from this initial batch of twenty external style sheets revealed varied results. For instance, sites like the European Commission portal and various political and organizational platforms showed substantial shifts. In some instances, applying straightforward external style sheet deduplication without strict savings filters resulted in a net increase in file size. This counter-intuitive expansion occurs because grouping long, complex selectors together to share a single declaration can sometimes add more character length through duplicated selector strings than is saved by removing the repeated property declaration.

However, when the tooling was configured to apply aggressive deduplication strictly tied to net savings, a different pattern emerged. Across a significant portion of the analyzed sites, the technique successfully trimmed file sizes by varying percentages, demonstrating that redundant declarations are indeed widespread in production environments.

These findings indicate that the effectiveness of UDJO depends heavily on the specific interplay between selector length and the frequency of duplicated declarations. When selectors are concise, deduplication yields clear performance wins. When selectors are excessively long and nested, grouping them can inflate the stylesheet unless managed carefully. Crucially, these raw file size metrics do not automatically quantify overall CSS code quality, as structural maintainability requires individual verification. Furthermore, these tests did not factor in post-compression reductions from modern algorithms like gzip or Brotli, which would provide an additional layer of evaluation in future experiments.

Despite these variables, the data confirms that UDJO remains fully functional in modern web environments. It operates effectively enough to consistently deliver tangible file size reductions when properly constrained.

To broaden the scope and understand how the technique performs within the codebases of modern web professionals and developer advocates, a secondary sample group was analyzed. This group included personal sites and digital spaces managed by prominent figures in the web development community.

The data gathered from these developer-centric sites revealed interesting nuances. While some professional sites saw minor file size expansions due to selector length trade-offs when applying broad external style sheet formatting, others experienced clear, measurable reductions under savings-focused deduplication.

While expanding this sample size in future studies would provide deeper statistical clarity, the preliminary data points toward an encouraging trend. Web professionals who intentionally write shorter, more modular selectors may be better positioned to reap the performance benefits of UDJO compared to legacy enterprise platforms burdened by deeply nested architectures.

On the Effectiveness of UDJO as a CSS Optimization Technique

As established, the overall efficacy of UDJO relies fundamentally on the nature of the repetition present in a codebase and the length of the associated selectors.

Fortunately, these variables can be actively managed. While automated tools like CSS Dedup operate without human context regarding specific declaration use cases—making them relatively blunt instruments—they can be finely configured to target safe optimizations while preserving architectural integrity.

The empirical data gathered across diverse websites suggests that meaningful file size savings can be achieved in the majority of use cases. Considering that these outcomes are derived from structurally safe modifications, UDJO presents a low-cost performance optimization vector, particularly when applied on top of standard minification processes. While it remains prudent to cross-reference these gains against the compression ratios achieved by modern transport protocols like gzip and Brotli, raw deduplication clearly demonstrates its ability to shrink the physical footprint of CSS assets.

For practitioners deeply interested in the intersection of CSS optimization, code maintainability, and runtime performance, UDJO deserves a place in the modern developer toolkit. Because the technique has largely remained a niche practice and comprehensive automation tooling is still relatively new, developers are encouraged to review, test, and explore this optimization vector within their own projects. The evidence suggests that the web development community has not yet reached the ultimate ceiling of how far CSS optimization can be taken.