-
-
Notifications
You must be signed in to change notification settings - Fork 1
Performance
Aegis is engineered for raw performance with a zero-base loading strategy. The theme loads zero CSS, JavaScript, or font assets by default — assets are loaded conditionally only when needed by the content on the page.
Traditional themes load their entire stylesheet and script bundle on every page, regardless of what the page actually uses. Aegis takes the opposite approach:
- Default state: No theme CSS, no theme JS, no web fonts loaded.
- Block detection: During rendering, Aegis detects which blocks are present on the page.
- Conditional loading: Only the styles and scripts required by those blocks are enqueued.
- Result: Pages that use only core blocks may load with zero theme-specific assets.
| Page Content | Assets Loaded |
|---|---|
| Simple page with only paragraphs and images | Zero theme CSS/JS (core styles only) |
| Page with a Slider block | Slider CSS + Slider JS only |
| Page with Countdown + Toggle | Countdown CSS/JS + Toggle CSS/JS |
| WooCommerce product page | WooCommerce integration styles only |
The asset loading system operates in three phases:
- Registration — All available assets are registered with WordPress but not enqueued.
- Detection — Block parsing identifies which blocks and variations are present in the content.
- Enqueueing — Only the assets required by detected blocks are added to the page.
Each custom block and enhanced core block declares its own dependencies:
// Example: Slider block registers its own assets
'style' => 'aegis-slider', // Frontend CSS
'script' => 'aegis-slider', // Frontend JS
'editor_style' => 'aegis-slider-editor', // Editor-only CSSThese assets are only loaded when the block appears on the page.
Plugin-specific compatibility styles follow the same pattern:
- WooCommerce styles load only on WooCommerce pages.
- LMS styles load only on course/lesson pages.
- Form styles load only when a form block is present.
Fonts are a significant performance factor. Aegis optimizes font loading:
All fonts (Lexend, Lexend Deca, JetBrains Mono) are served from the theme directory:
- No external requests to Google Fonts or other CDNs.
- Fonts are available immediately without DNS lookup or connection overhead.
- Full control over caching headers.
Using variable font files reduces the number of HTTP requests:
- One file for Lexend covers all weights (100–900).
- One file for Lexend Deca covers all weights.
- One file for JetBrains Mono covers regular and italic.
Fonts use font-display: swap:
- Text is immediately visible using a system font fallback.
- Custom fonts swap in once loaded.
- No flash of invisible text (FOIT).
- Minimal flash of unstyled text (FOUT) due to similar font metrics.
Fonts are only loaded when they are actually used on the page:
- JetBrains Mono loads only when a code block is present.
- If a style variation uses only one font family, the unused font does not load.
Aegis supports WordPress native image optimization:
-
Responsive images —
srcsetandsizesattributes for proper resolution selection. -
Lazy loading — Images below the fold use
loading="lazy". - Aspect ratio — Explicit width and height attributes prevent layout shift.
- WebP/AVIF — Works with WordPress image format conversion.
The Video block uses a facade pattern:
- A lightweight thumbnail image is displayed initially.
- The video player (iframe or native) loads only when the user clicks play.
- This eliminates heavy third-party script loading on page load.
Aegis minimizes render-blocking resources:
| Resource Type | Loading Strategy |
|---|---|
| Theme CSS | Conditional, only per-block styles |
| Theme JS | Deferred, conditional per-block |
| Fonts | Preloaded for above-the-fold content |
| Images | Lazy loaded below the fold |
| Videos | Facade until interaction |
| Analytics | Async/defer, non-blocking |
Aegis is optimized for Google Core Web Vitals:
| Metric | Target | How Aegis Helps |
|---|---|---|
| LCP (Largest Contentful Paint) | < 2.5s | Minimal CSS, font preloading, no JS blocking |
| FID (First Input Delay) | < 100ms | Deferred JS, minimal main-thread work |
| CLS (Cumulative Layout Shift) | < 0.1 | Explicit image dimensions, font-display swap |
| INP (Interaction to Next Paint) | < 200ms | Lightweight event handlers, no heavy frameworks |
| Tool | Purpose |
|---|---|
| WPAudit | WordPress-specific performance audit |
| Lighthouse | General web performance scoring |
| WebPageTest | Detailed waterfall analysis |
| PageSpeed Insights | Field data + lab data analysis |
npm run auditSee testing for more details on running performance tests.
Aegis works with all major caching solutions:
- Page caching — Full page cache safe (no user-specific content in templates).
- Object caching — Compatible with Redis and Memcached.
- CDN — All static assets use cache-friendly URLs.
- Browser caching — Assets include proper cache headers.
The theme produces minimal asset bundles:
| Asset | Typical Size |
|---|---|
| Per-block CSS | 1–5 KB (gzipped) |
| Per-block JS | 2–10 KB (gzipped) |
| Font file (variable) | 30–60 KB (per family) |
| Total typical page | Under 50 KB theme assets |
When building custom pages or templates:
- Prefer core blocks — They have zero theme asset cost.
- Minimize custom block usage — Each custom block adds its CSS/JS bundle.
- Use patterns — Patterns are just block markup, not additional assets.
- Avoid global stylesheets — Do not add blanket CSS that loads everywhere.
- Test with Lighthouse — Verify performance after significant changes.
- conditional-logic — Related conditional loading for content visibility.
- testing — Running performance tests.
- building-assets — Understanding the build process.
- deployment — Production deployment considerations.
Aegis version 1.0.0 | GitHub Repository | Report an Issue | Atmostfear Entertainment
License: GPL-2.0-or-later