filter · CSS filters
Inline Google Fonts CSS (inline_google_font_css)
- Category:
- CSS
- CoreFilters:
- No
- OptimizeForBandwidth:
- No
- Risk:
- Generally safe
Fetches the CSS from the Google Fonts API and inlines it directly into the HTML, eliminating one round trip. Requires HTTPS fetching to be enabled. GDPR considerations apply in the EU: inlining the CSS avoids the browser contacting Google Fonts servers directly, which can help with compliance.
When to use it
- Not in CoreFilters: it runs only when you enable it by name.
- Risk rating on these docs: Generally safe.
Risks
The
CSS filters
page lists no specific risks for this filter.
If a page misbehaves with it, DisableFilters inline_google_font_css turns it off for
the scope you set it in.
Configuration
Enable it in the module configuration, at server, virtual-host or location scope:
Apache
ModPagespeedEnableFilters inline_google_font_cssnginx
pagespeed EnableFilters inline_google_font_css;IIS (pagespeed.config)
pagespeed EnableFilters inline_google_font_css
Scoping, ForbidFilters and the thresholds filters read:
Choosing filters
.
Live example
Inlines the small font-loading CSS that the Google Fonts API serves.
Measured on the demo page, original against optimized:
-
Total bytes
569 B → 559 B −2%
Frequently asked questions
- What does the inline_google_font_css filter do?
- Fetches the CSS from the Google Fonts API and inlines it directly into the HTML, eliminating one round trip. Requires HTTPS fetching to be enabled. GDPR considerations apply in the EU: inlining the CSS avoids the browser contacting Google Fonts servers directly, which can help with compliance.
- Is inline_google_font_css enabled by default?
- No.
inline_google_font_cssis not in CoreFilters, the default RewriteLevel; it runs only when you enable it by name withEnableFilters. - How do I enable inline_google_font_css on Apache and nginx?
- Add
ModPagespeedEnableFilters inline_google_font_csson Apache orpagespeed EnableFilters inline_google_font_css;on nginx. On IIS, addpagespeed EnableFilters inline_google_font_cssto pagespeed.config.
Related filters
- combine_css — Combine CSS
- compute_critical_css — Compute critical CSS
- extend_cache_css — Extend cache for CSS
- fallback_rewrite_css_urls — Fallback CSS URL rewriting
- flatten_css_imports — Flatten CSS @imports
- inline_css — Inline CSS
- inline_import_to_link — Convert @import to link
- move_css_above_scripts — Move CSS above scripts
This page is drawn from the inline_google_font_css entry on CSS filters. Every filter in one table: PageSpeed filters.
Google Analytics, AdSense, Fonts and Hosted Libraries are Google products. We-Amp isn't affiliated with or endorsed by Google.