Performance

How the Custom theme loads its styles and scripts, and the example pages we measure it against.

Table of Contents

Style loading order

Everything needed for the first paint is in the <head>, most of it printed inline. Only what can wait comes later.

In the <head>:

  1. WordPress block styles, only for the blocks the page actually uses. Small ones are printed inline; larger ones such as Navigation or Cover come as their own stylesheet, because WordPress inlines block styles only up to a size limit
  2. Global styles from theme.json, inline
  3. Section and block styles from styles/, inline
  4. The WooCommerce stylesheets, on shop, cart, checkout and account pages only
  5. Swiper, as a stylesheet, bundled locally with no CDN
  6. The theme’s own CSS, inline. The theme compiles its entire front-end CSS into critical.scss, and it is printed into the <head>, so the page renders styled without waiting for a stylesheet request

At the end of the <body>:

  1. style.min.css, the place for rules that may arrive late; empty by default
  2. The WooCommerce stylesheets, on every page outside the shop, where nothing above the fold needs them
  3. print.min.css for printing

A style for a new pattern therefore belongs in critical.scss. Added to style.scss, it would arrive after the markup has rendered: a visible flash of unstyled content.


Scripts

All theme modules are bundled into one minified file, assets/scripts-bundle.min.js. The bundle, jQuery and the locally bundled Swiper script are all deferred, so none of them blocks rendering.


Edge cases

We measure the theme against eight example pages. Each is a realistic page and stresses the theme in its own way. After changes that affect loading, run each one through PageSpeed Insights; the last column starts the analysis.

PageWhat it stressesMeasure
Example 1Home page: 100% Core, many images, no JavaScript patternsPageSpeed Insights
Example 2Service page: 100% Core, lots of text, few images, no JavaScript patternsPageSpeed Insights
Example 3Landing page: text-heavy Custom patterns with light JavaScript (count-up, tabs, accordion)PageSpeed Insights
Example 4About page: Custom patterns with many images and heavy JavaScript (a slider, CV dialogs, collapsible footer navigation)PageSpeed Insights
Example 5Shop home page: WooCommerce product queries with many images, sliders and the mini cartPageSpeed Insights
Example 6Contact page: form styles, an embedded third-party map and a header with Mega Menu panelsPageSpeed Insights
Example 7Section page: 100% Core with a page query loop, no JavaScript patternsPageSpeed Insights
Example 8Guide article: a long page with the table-of-contents script and a post queryPageSpeed Insights