Lighthouse Part 1: The 'Parabaked' Web
Lighthouse Part 1: The "Parabaked" Web
- Part 1 of 4 - Build-Time AVIF/WebP Pipelines & Ruby HTML Hooks
Introduction
When optimising modern web applications, architectural compromises often emerge between pure static site generators and client-rendered Single Page Applications . Static pipelines deliver maximum speed without deep interactivity, whereas client-heavy frameworks provide reactivity alongside bloated JavaScript payloads and severe layout instability.
The "parbaked" (partially baked) hybrid web architecture resolves this tension through strict operational rules. Building upon established patterns like the Jamstack , Islands Architecture , and Astro's partial hydration , the parbaked model relies on two primary mechanics:
- Strict Static Generation : It enforces absolute Static Site Generation (SSG) using Jekyll, completely locking the DOM at build time.
- Controlled Hydration : Vanilla client-side hydration handles interactivity without triggering layout recalculations common in standard partial hydration models.
By standardising structural dimensions and media formatting during the build phase, the rendering path mathematically prevents Cumulative Layout Shift (CLS) and CPU thrashing. Establishing this parbaked foundation requires two specific implementations:
- Automated Asset Pipelines : A zero-configuration AVIF/WebP image pipeline for payload minimisation.
- Build-Time Compilation : A custom, manifest-driven Ruby post-render compiler.
1. The parbaked Architecture Explained
The parbaked architecture enforces strict separation of concerns through two operational layers. This segregation occurs across the build and hydration phases:
- Static Crust Pre-rendering : The system pre-renders structural layout frames, core page shells, and critical payload batches at compile time using Jekyll's static site generation pipeline .
- Skeletal Resolution : HTML node dimensions resolve statically during the build phase, forcing the browser to paint the exact skeletal structure immediately without runtime calculations.
Following the initial paint, the dynamic hydration layer initialises. This system handles specific client-side responsibilities:
- Progressive Rendering : The client orchestrates progressive rendering payloads.
- State Management : The layer executes local search indexing and accessibility state toggles without modifying pre-established structural DOM boundaries.
- Reflow Prevention : The "baked in the source" constraint acts as a physical barrier against initial render reflows.

2. Next-Gen Image Compression: AVIF & WebP Pipeline
To minimise payload weights without relying on client-side decompression, the build pipeline statically converts legacy JPEGs and PNGs into AVIF and WebP containers. Initial iterations utilised Python's Pillow library to achieve 50% to 70% byte size reductions, but enterprise pipelines require parallelised execution.
Bypassing Python's GIL constraints dictates a transition to C/Rust/Go-backed processors like libvips or Node's sharp. This infrastructure upgrade yields two immediate optimisations:
- Overhead Reduction : The shift decreases the computational overhead of AVIF encoding without perceptual quality loss.
- Throughput Maximisation : Parallel processing enables rapid compilation of dense asset directories.
Incomplete AVIF browser support across older Safari and Android WebView runtimes necessitates a strict triple-format fallback chain. For every processed asset, the pipeline generates three deterministic file outputs:
- Primary Format : A .avif asset for modern execution contexts.
- Secondary Fallback : A .webp asset for intermediary browser support.
- Legacy Container : A .jpg or .png fallback.
Assets are precisely cropped to four responsive breakpoints in accordance with responsive images guidance :
- Wide : 1200px key width (min-width: 1200px).
- Medium : 900px for tablet viewports (min-width: 600px).
- Mobile : 600px for mobile (max-width: 599px).
- Thumbnails : 120px fixed height for search indices.

3. Zero-Authoring-Over-the-Shoulder: The Manifest-Driven HTML Compiler
Expecting content contributors to manually author multi-format HTML <picture> elements in Markdown introduces a high margin for human error. This intervention occurs programmatically via a Ruby post-render hook executed during the :post_render event lifecycle.
Legacy architectures execute synchronous File.exist? checks against the physical disk for every asset, creating a massive I/O bottleneck that blocks the main compilation thread. To guarantee enterprise scalability, the architecture implements a Manifest-Driven Build infrastructure through three sequenced steps:
- Asset Graph Generation : The pipeline compiler outputs a deterministic JSON file mapping every original image to its AVIF and WebP derivatives.
- Memory Loading : The Ruby script loads the JSON manifest into memory exactly once when Jekyll's :post_render event fires.
- HTML Rewriting : The compiler intercepts the HTML payload and rewrites standard <img> tags into multi-source <picture> structures.
The compiler executes an O(1) in-memory hash lookup to bypass O(N) physical disk checks. This hook triggers conditional logic based on manifest verification:
- Asset Verification : If the optimised assets exist in the manifest, the script injects the corresponding <source> parameters.
- Graceful Degradation : If assets are missing, the compiler defaults to the standard lazy-loaded <img> element.

4. Demanding Efficiency: In-Memory Manifests and CI/CD Orchestration
Advanced image processing dictates high computational throughput. AVIF encoding relies on libaom or libavif system dependencies, consuming substantial CPU resources during compilation.
True enterprise architectures tolerate zero performance degradation across the pipeline. To prevent CI/CD timeouts, architects must implement two mandatory caching protocols:
- Parallel CI Caching : Build runners require parallelised cache extraction for dependency trees.
- Persistent Directories : Pre-cached asset output folders must persist across sequential builds.
Relying on physical disk checks during the HTML rendering phase scales poorly under load. For a repository with 5,000 images, executing 10,000 to 15,000 synchronous read operations guarantees standard CI runner timeouts.
Shifting the build logic to in-memory asset graphing via JSON manifests removes the false dichotomy between compile-time speed and client-side performance. This approach yields two systemic benefits:
- Latency Elimination : The compiler transitions from O(N) disk I/O latency to near-instantaneous O(1) memory lookups.
- Dual-Ended Efficiency : The architecture guarantees maximum throughput on both the backend CI/CD pipeline and the frontend client payload.

Conclusion & Strategic Advice
The parbaked ecosystem operates on strict integration between aggressive static generation and automated build-time pipelines. By offloading complex media formatting to parallelised processors like libvips and automating HTML source negotiation via manifest-driven Ruby hooks, the architecture completely insulates the end-user from heavy computational rendering.
For environments requiring a 100/100 Lighthouse performance score , we need to confirm that this zero-authoring deployment pipeline remains non-negotiable. The subsequent iteration of this workflow targets browser rendering stability through three specific techniques:
- Critical Path Extraction : Deploying critical CSS inlining for immediate skeletal paints.
- Typography Optimisation : Implementing font subsetting to minimise initial byte payloads.
- Layout Stabilisation : Utilising inert template containers to eliminate Cumulative Layout Shift (0.00 CLS).
For a detailed breakdown of these rendering techniques, review Lighthouse Part 2: CLS & Layout Stability .
💬 What architectural compromises are you currently making for client-side interactivity, and could a parbaked approach bridge your performance gaps? Share your insights and ♻️ share this post with your frontend engineering network!
Further Reading
The following resources provide foundational specifications for this architecture:
- Serve Responsive Images ( web.dev )
- AVIF Image Format Specifications (MDN Web Docs)
- Jekyll Plugin Hooks Architecture (Jekyll Documentation)
More From Me
Review these additional guides for comprehensive technical architecture strategies:
Original Article: Read on LinkedIn | Read on Substack