How it works

For developersVersion 1.0.0Last updated:

Optimization happens at two moments, and the original files are never touched: if an optimized copy is missing, the original is served.

The two phases of optimization. On sync: Google Fonts are downloaded, images, fonts, CSS and JS are analyzed, optimized copies are generated next to the originals and the browser cache is written. On every visit: lazy-load and priority for a main image, only the CSS of the sections on the page, the optimized copies are served (or the originals if something is missing), and if you change something the page caches are cleared. The originals are never touched.The two phases of optimization. On sync: Google Fonts are downloaded, images, fonts, CSS and JS are analyzed, optimized copies are generated next to the originals and the browser cache is written. On every visit: lazy-load and priority for a main image, only the CSS of the sections on the page, the optimized copies are served (or the originals if something is missing), and if you change something the page caches are cleared. The originals are never touched.
  Al sincronizar                                   En cada visita
  ──────────────                                   ──────────────
  1. Descarga las Google Fonts del paquete          5. Secciones: lazy-load, prioridad de UNA
     a uploads/builder-os/fonts/                       imagen principal, srcset y espacio
  2. Analiza imágenes, fuentes, CSS y JS               reservado (CLS)
  3. Genera copias optimizadas junto a              6. <head>: solo el CSS de las secciones de
     los originales, con un hash en el nombre:         la página (CSS por sección), en línea si
       styles.css → styles.1a2b3c4d.bos-opt.css        cabe; fuentes desde el propio sitio
       main.js    → main.1a2b3c4d.bos-opt.js        7. Sirve las copias optimizadas, los WebP y
       foto.jpg   → foto.jpg.webp                      los tamaños (o los originales si algo
                    foto.jpg.w480.webp, .w768...       falta)
     y un índice del CSS por sección               8. Si cambias algo, vacía las cachés
  4. Escribe la caché del navegador (.htaccess)        de página
     y agrega avisos al informe
  • Optimized copies are stored inside the version folder (uploads/builder-os/packages/<slug>/versions/<versión>/) and described in .bos/perf.json. The original files are never touched.
  • If a copy doesn’t exist or was generated with other settings, the original is served. Going back to an earlier version (rollback) works the same way: if that version wasn’t optimized, its originals are served and it is optimized in the background (WP-Cron).
  • Each visit’s optimizations are applied after the sections cache, so BuilderOS’s cache always stores the original HTML and nothing is applied twice.
  • They aren’t applied in the editor: the editor keeps using the original CSS, JS and fonts.

Builder and viewer:

  • builder-os-layout-pro.css (advanced widgets), builder-os-lightbox.js/.css (viewer) and builder-os-layout.js only load on pages that use them. They are detected before the <head> in the content, in theme templates, in global items and in package templates. If a block renders them later, they load in the footer.
  • Visitor data (URL parameter, today’s date) and closed announcement bars are resolved in the browser: the page stays cacheable.
  • Background video isn’t downloaded with “reduce motion” or (by default) on mobile.