Skip to content
OpenCart · User manual

Performance Pro

Version 1.4.2 Product page
Chapter 7

CSS, JavaScript and images

What the CSS and JavaScript category and the Images category change in the pages your visitors receive, on any theme and on Journal 3.

Where these optimisations apply

Both categories act on the same public pages as the page cache, and only while Enable caching is on. They never touch the cart, the checkout, the account area or your administration.

Every change is conservative: when a page does not have exactly the shape Performance Pro expects, it is delivered as your theme wrote it.

CSS and JavaScript on any theme

Joined script files

Local script files that follow one another in the page are joined into a single file, in their original order and with their contents unchanged. The browser then makes one request instead of several.

Scripts are left as they are when they are loaded from another site, when they are marked async or defer, when they are modules, when they carry an integrity check, and when inline code stands between them.

Compression

The page is sent compressed where OpenCart supports it.

Google Tag Manager waits for the visitor

If your pages contain the standard Google Tag Manager snippet, it starts with the visitor's first touch, scroll or key press, or seven seconds after the page has loaded, instead of competing with the main content while the page appears.

  • Only the exact snippet published by Google, with the default data layer name and a single container, is moved. Any other form stays as it was.
  • Events pushed to the data layer before the container starts are kept and processed when it starts.

OpenCart 4 stock theme

On the stock theme of OpenCart 4 the product grid is printed with its final layout from the start, so the product cards no longer move while the page loads.

Journal 3 on OpenCart 3

With the Journal 3 theme on OpenCart 3, the category also prepares the first paint of the page. Journal keeps its modules, galleries and behaviour.

  • Initial styles. The page is painted from the part of the styles that this page really uses. The full style sheets arrive afterwards.
  • Scripts wait. The page's scripts keep their order but start with the visitor's first interaction, or after a short wait once the page has loaded. Visitor measurement services are not delayed in the same way, so a visit is still counted.
  • Icon font. A light copy of the theme's icon font, made on your store from your own file, arrives first; the full font follows.

These Journal improvements act on OpenCart 3 only. On OpenCart 1.5, 2.x and 4 a Journal store still gets the page cache and the other optimisations.

Images

WebP conversion

Local images in your pages are served as WebP, a lighter format, when all of this is true:

  • your server's PHP has the GD library with WebP support;
  • the visitor's browser says it accepts WebP (all current browsers do);
  • the original is a JPEG or PNG file of your own shop, between 4 KB and 512 KB;
  • the WebP copy turns out smaller than the original.

Otherwise the original image is served, as before. Your original files are never changed or deleted.

  • Quality. WebP copies are created at quality 82. This value is fixed; there is no quality setting.
  • Where the copies are. In the folder image/cache/performance_pro_independent/ of your shop, together with the joined script files. Both are created again when needed. If you ever empty that folder, press Clear cache straight afterwards, so no stored page still points to a deleted file.
  • Gradual conversion. To keep every visitor's page fast, a page view converts only two new images. The rest follow on the next views, so right after enabling the category a page can still show some original images. This is expected and completes by itself.
  • Large images. Images up to four megapixels are converted, the larger ones only when PHP has enough memory available.

Responsive images (srcset) and images loaded by the theme's own lazy loader are converted too, each size separately.

The main image first

On a product page the product's main image is marked so the browser fetches it before the rest.

Lazy loading on Journal 3

On Journal 3 with OpenCart 3, images that state their size are loaded when they come near the visible part of the screen, so the few images that open the page do not compete with hundreds further down or inside closed menus.

  • The store logo and a category's own image are never deferred.
  • The page learns from your visitors' browsers which image is the largest one on screen, and stops deferring it. This happens by itself after a few visits and is separate for phones and desktops.

On other themes Performance Pro adds no lazy loading: the theme's own behaviour stays as it is.

OpenCart 4 stock theme

On the stock theme of OpenCart 4, space is reserved for images before they arrive, so the page does not shift while loading.

Pages with a content security policy

If your shop sends a Content-Security-Policy that restricts scripts or styles, the optimisations that add or move scripts and styles are skipped, and the page is delivered as your theme wrote it.

Still need help?

Open a support ticket from your account and our team will look at your store with you.