How to prepare the package so BuilderOS optimizes it to the maximum
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:
- 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,.cardwithout a prefix). - 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. Noloading="lazy"on that image. - Carousels: the first slide normal; the following ones with
loading="lazy"(BuilderOS also does it if you forget). - Images at just the right size: at most 2× the largest width they are displayed at, in WebP, and always with real
widthandheight(the file’s aspect ratio). BuilderOS generates the smaller sizes for mobile (srcset). To cover a section use<img>withobject-fit: cover, not a CSS background. - Libraries inside the package (
/js/), not from a CDN. And GSAP/ScrollTrigger only where it truly adds value: for simple reveals CSS +IntersectionObserveris enough, or BuilderOS’s animations (data-bos-animin the package’s HTML), which the client can edit. - JS without forced reflow: don’t read
getBoundingClientRect/offsetTopon every scroll and then write styles. UseIntersectionObserver, or read everything and then write insiderequestAnimationFrame. Initialize withBuilderOS.readyand withoutdocument.write(it is loaded withdefer). - State classes with an
is-/has-prefix (is-open,is-active) and added withclassListand literal strings: BuilderOS recognizes them and never removes their rules. - 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/withfont-display: swap. Declare the text font inbody { font-family: ... }. - 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.
- Videos and iframes outside the first section (they load deferred); for a background video,
posterandpreload="none". - 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", withdata-bos-anim-delayand-staggeron 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 arichtextin the list or fixed elements withtoggle. In the counters of a list,data-bos-option-prefix/-suffixapply 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 inpageswith'blog': true(no sections) and link it by its file (blog.html). Do not link to.htmlfiles that are not pages inpages.”