filter · CSS filters
Extend cache for CSS (extend_cache_css)
- Category:
- CSS
- CoreFilters:
- Yes
- OptimizeForBandwidth:
- No
- Risk:
- Generally safe
Core filter, one of the three members of extend_cache. Rewrites <link rel="stylesheet"> URLs to content-hashed .pagespeed.ce. URLs that the module serves with a one-year Cache-Control max-age, so browsers keep stylesheets for a year and still pick up every change (a changed file gets a new URL). Use it when the origin cannot set long cache lifetimes itself; under CoreFilters it is already on through extend_cache.
How it works
Disabling it leaves extend_cache_images and extend_cache_scripts on. The one rule to respect is the general one: HTML and the resources it references must share one configuration (see Virtual hosts). Live demo: extend_cache.
When to use it
- In CoreFilters, the default RewriteLevel: it runs unless you disable it.
- Also switched on by
extend_cache. - 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 extend_cache_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 extend_cache_cssnginx
pagespeed EnableFilters extend_cache_css;IIS (pagespeed.config)
pagespeed EnableFilters extend_cache_cssIt is on by default under CoreFilters; to turn it off:
ModPagespeedDisableFilters extend_cache_css # Apache
pagespeed DisableFilters extend_cache_css; # nginx
pagespeed DisableFilters extend_cache_css # IISOn the worker
The worker runs its own pipeline, configured by flags. Its equivalent of this filter
is the
cache extension
transform. Always-on under pagespeed on;.
Scoping, ForbidFilters and the thresholds filters read:
Choosing filters
.
Frequently asked questions
- What does the extend_cache_css filter do?
- Core filter, one of the three members of
extend_cache. Rewrites<link rel="stylesheet">URLs to content-hashed.pagespeed.ce.URLs that the module serves with a one-yearCache-Controlmax-age, so browsers keep stylesheets for a year and still pick up every change (a changed file gets a new URL). Use it when the origin cannot set long cache lifetimes itself; under CoreFilters it is already on throughextend_cache. - Is extend_cache_css enabled by default?
- Yes.
extend_cache_cssis in CoreFilters, the default RewriteLevel, so it runs unless you turn it off withDisableFilters. - How do I turn off extend_cache_css?
- Add
ModPagespeedDisableFilters extend_cache_csson Apache orpagespeed DisableFilters extend_cache_css;on nginx. On IIS, addpagespeed DisableFilters extend_cache_cssto pagespeed.config.
Related filters
- combine_css — Combine CSS
- compute_critical_css — Compute critical CSS
- fallback_rewrite_css_urls — Fallback CSS URL rewriting
- flatten_css_imports — Flatten CSS @imports
- inline_css — Inline CSS
- inline_google_font_css — Inline Google Fonts CSS
- inline_import_to_link — Convert @import to link
- move_css_above_scripts — Move CSS above scripts
This page is drawn from the extend_cache_css entry on CSS filters. Every filter in one table: PageSpeed filters.