How to prepare the package so BuilderOS optimizes it to the maximum

For developersVersion 1.0.0Last updated:

BuilderOS optimizes the delivery of any package, but the weight and shape of the CSS are decided by whoever creates it. These rules make each optimization pay off to the maximum from the first sync:

  1. CSS organized per section, with prefixed classes. Each section uses its own classes (.hero__title, .hero__media, .blog-card, .team__grid…). What is global is limited to variables (:root), reset and base typography. That way “CSS per section” sends each page only its CSS and it usually fits inline (zero blocking sheets). Avoid generic classes used in all sections with many rules (.title, .box, .card without a prefix).
  2. A single main image per page, marked. Put fetchpriority="high" on the main image (the large one in the first section) and only on it. No loading="lazy" on that image.
  3. Carousels: the first slide normal; the following ones with loading="lazy" (BuilderOS also does it if you forget).
  4. Images at just the right size: at most 2× the largest width they are displayed at, in WebP, and always with real width and height (the file’s aspect ratio). BuilderOS generates the smaller sizes for mobile (srcset). To cover a section use <img> with object-fit: cover, not a CSS background.
  5. Libraries inside the package (/js/), not from a CDN. And GSAP/ScrollTrigger only where it truly adds value: for simple reveals CSS + IntersectionObserver is enough, or BuilderOS’s animations (data-bos-anim in the package’s HTML), which the client can edit.
  6. JS without forced reflow: don’t read getBoundingClientRect/offsetTop on every scroll and then write styles. Use IntersectionObserver, or read everything and then write inside requestAnimationFrame. Initialize with BuilderOS.ready and without document.write (it is loaded with defer).
  7. State classes with an is-/has- prefix (is-open, is-active) and added with classList and literal strings: BuilderOS recognizes them and never removes their rules.
  8. Fonts: at most 2 families, in woff2 and variable if possible (one variable font replaces several weights). Google Fonts with <link> (BuilderOS serves them from the site) or files in /assets/fonts/ with font-display: swap. Declare the text font in body { font-family: ... }.
  9. Not depending on the WordPress theme: the package defines its typography, colors, margins and reset. That way the theme’s styles can be removed (Home → Header and footer → “Remove theme styles”) without anything changing.
  10. Videos and iframes outside the first section (they load deferred); for a background video, poster and preload="none".
  11. Optimized SVGs for icons and logos.

Text for the AI prompt:

“Prepare the package for BuilderOS with maximum performance: organize the CSS by section, with classes prefixed by each section’s name (.hero__title, .blog-card), and leave as global only variables, reset and base typography; mark with fetchpriority=”high” only the main image of each page (without loading=”lazy”) and add loading=”lazy” to carousel slides from the second one onward; export images as WebP at most 2× their largest displayed width, with real width and height on every <img> (BuilderOS creates the mobile sizes); include libraries in /js/ instead of loading them from a CDN and use GSAP/ScrollTrigger only where it adds value, using CSS + IntersectionObserver or BuilderOS animations (data-bos-anim="fade-up", with data-bos-anim-delay and -stagger on lists) for simple reveals, without hiding anything with your CSS; do not read DOM measurements in scroll events (use IntersectionObserver or requestAnimationFrame); add state classes (is-open, is-active) with classList and literal strings; use at most two font families in woff2 (variable if possible) and declare the body text one on body; and do not depend on the WordPress theme’s styles. Do not nest a repeater inside another: for a list inside each card use a richtext in the list or fixed elements with toggle. In the counters of a list, data-bos-option-prefix/-suffix apply to all of them; if the sign changes between figures, write it in each one’s number (+1,200, 98%). If the site has a blog, declare its page in pages with 'blog': true (no sections) and link it by its file (blog.html). Do not link to .html files that are not pages in pages.”