Drupal is a registered trademark of Dries Buytaert
Release: Leaflet 10.4.11 Minor update available for module leaflet (10.4.11). Release: Session Inspector 1.0.8 Minor update available for module session_inspector (1.0.8). Release: Migrate QA 2.0.4 Minor update available for module migrate_qa (2.0.4). Release: CKEditor Description List 3.0.0 Major update available for module ckeditor_descriptionlist (3.0.0). Release: FlowDrop 2.4.0 Minor update available for module flowdrop (2.4.0). Release: JWT Token Refresh 1.0.4 Minor update available for module jwt_token_refresh (1.0.4). Release: ConReg 1.0.0-beta1 First beta version released for module conreg (1.0.0-beta1). Release: AI Image Studio 1.0.0-beta8 New beta version released for module ai_image_studio (1.0.0-beta8). Usage Milestone: Statistics Counter Module statistics_counter crossed 1,000 active installs. Module Revived: Decoupled Router 2.0.7 Module decoupled_router updated after 11 months of inactivity (2.0.7).

Critical CSS

2,347 sites Security covered
View on drupal.org

This module embeds critical CSS directly into the HTML head of your pages, then loads all other CSS asynchronously. This improves initial page load performance by ensuring the most important styles are applied immediately.

Embeds a critical CSS file into a page's HTML head, and loads the rest of non-critical CSS asynchronously.

INTRODUCTION

  1. This module looks for a CSS file inside your active theme directory. This CSS filename should match any of:
    • bundle type (i.e., "article.css")
    • entity id (i.e., "123.css")
    • url (i.e., "my-article.css")
  2. If none of the previous filenames can be found, this module will search for a file named "default-critical.css".
  3. A hook is provided ("critical_css_file_paths_suggestion") in case another filename is needed.
  4. If any of the above paths is found, this module loads the CSS file contents inside a <style> tag placed in the HTML head.
  5. Any other CSS file used in the HTML head is loaded asynchronously using this
    strategy. No need for polyfills.

REQUIREMENTS

Before this module can do anything, you should generate the critical CSS of the page.

This can be achieved by running a Gulp task to automatically extract the critical CSS of any page. Using Addy Osmani's critical package is highly recommended.

Another option is Filament Group's criticalCSS.

There are also some critical CSS online generators to get that CSS without effort.

The extracted critical CSS must be saved in a directory inside the current theme, at the location specified on Critical CSS's config page.

CONFIGURATION

Module must be enabled in /admin/config/development/performance/critical-css. This allows for easy enabling/disabling without uninstalling it.

DEBUGGING

When twig debug is enabled, Critical CSS will show all the possible file paths that is trying to find inside a css comment.

If you see ‘NONE MATCHED’, check to see if you are logged in and make sure Critical CSS is enabled for logged-in users. Since the contents of the critical CSS files are generated emulating an anonymous visit, I recommend disabling this feature once you’ve finished testing.

Activity

Tracked releases
3
Tracked since
Aug 2026
Latest release
2 days ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Release date
2.0.6 Stable Aug 21, 2026
2.0.5 Stable Aug 21, 2026
2.0.4 Stable Aug 21, 2026