Flyweight
Share common style properties to reduce CSS payload and memory usage.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Flyweight
ARCANUM SCHOOL: Transmutation // Memory Compression
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
/* Intrinsic flyweight state shared across many elements */
.text-center { text-align: center; }
.margin-auto { margin: 0 auto; }
.hidden { display: none !important; }
.flex-center { display: flex; align-items: center; justify-content: center; }
/* Reusing common magical properties rather than repeating them in every component */
The Flyweight pattern mirrors utility classes. By extracting shared, repetitive style rules into singular reusable classes, the overall size of the spellbook (CSS file) is drastically minimized.
Runic Tags:
#css
#optimization
#sharing
#design-patterns