Skip to content

Preload the Latin Inter fonts every page uses - #1148

Open
MaximeBen wants to merge 1 commit into
PrestaShop:2.1.xfrom
MaximeBen:perf/preload-inter-latin
Open

MaximeBen wants to merge 1 commit into
PrestaShop:2.1.xfrom
MaximeBen:perf/preload-inter-latin

Conversation

@MaximeBen

Copy link
Copy Markdown
Questions Answers
Description? webpack-font-preload-plugin only preloads Material Icons (filter: /(materialicons)/i). Inter is declared in theme.css, so the browser only discovers inter-latin-400-normal and inter-latin-600-normal once that stylesheet has been downloaded and parsed: one full round trip after it. Both files are requested on the home, category and product pages (400 for the body text, 600 for $headings-font-weight), so the filter now matches them too and preload.html gets two more <link rel="preload" as="font" crossorigin>.

Only the Latin subset is matched (inter-latin-(400|600)-normal): latin-ext, cyrillic, greek and vietnamese, and the 100/300/700 weights, stay on demand, as preloading a file a page does not use is a download for nothing. The two files are 23.7 KB and 24.5 KB (woff2). The preload URLs are the ones the stylesheet resolves (assets/fonts/…, same hashed names), with or without CCC, so nothing is downloaded twice.
Type? improvement
BC breaks? no
Deprecations? no
Fixed ticket?
Sponsor company Mintfull Agency
How to test? Build the theme (npm run build) and open assets/preload.html: it lists Material Icons, Inter Latin 400 and Inter Latin 600.

On a page, the Network tab shows both Inter files requested together with Material Icons, before theme.css has finished, instead of after it, and the console has no "preloaded but not used" warning.

Measured on PrestaShop 9.2 with demo data, mobile Lighthouse 12.8.2 (--throttling-method=simulate, the PageSpeed default), 3 runs each, medians (min-max):
- home: First Contentful Paint 1807 ms (1805-1809) -> 1356 ms (1354-1356), Speed Index 1902 -> 1867 ms, score 78 -> 79
- product page: First Contentful Paint 1656 ms (1655-1657) -> 1203 ms (1203-1203), Speed Index 1656 -> 1391 ms, score 86 -> 87

Largest Contentful Paint does not move: it is an image on both pages (the image slider on the home, the product cover on the product page). Each font is still downloaded once.

🤖 Generated with Claude Code

Only Material Icons was preloaded, so the browser discovered Inter 400 and
600 once theme.css had been downloaded and parsed, one round trip after the
stylesheet. Both are requested on the home, category and product pages
(body text and headings), so they are now preloaded too. Only the Latin
subset is matched; the other subsets and weights stay on demand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ps-jarvis

Copy link
Copy Markdown

Hello @MaximeBen!

This is your first pull request on hummingbird repository of the PrestaShop project.

Thank you, and welcome to this Open Source community!

@github-project-automation github-project-automation Bot moved this to Ready for review in PR Dashboard Nov 25, 2026
@ps-jarvis ps-jarvis added the Waiting for QA Status: Action required, Waiting for test feedback label Nov 25, 2026
@ps-jarvis ps-jarvis moved this from Ready for review to To be tested in PR Dashboard Nov 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Waiting for QA Status: Action required, Waiting for test feedback

Projects

Status: To be tested

Development

Successfully merging this pull request may close these issues.

3 participants