Skip to main content
drupalreleases
Release: Cms 2.2.3 — Update released for Drupal core (2.2.3)! Release: Easy Breadcrumb 2.0.11 — Minor update available for module easy_breadcrumb (2.0.11). Release: Bootstrap 8.x-3.42 — Minor update available for theme bootstrap (8.x-3.42). Release: Editoria11y Accessibility Checker 3.0.10 — Minor update available for module editoria11y (3.0.10). Release: Editoria11y Accessibility Checker 2.2.24 — Minor update available for module editoria11y (2.2.24). Release: Leaflet 10.4.13 — Minor update available for module leaflet (10.4.13). Release: Flag 5.1.1 — Minor update available for module flag (5.1.1). Release: MCP Sentinel 2.33.0 — Minor update available for module mcp_sentinel (2.33.0). Module Revived: Bootstrap 8.x-3.41 — Theme bootstrap updated after 6 months of inactivity (8.x-3.41). Security Coverage: Component Library — Module component_library now has official Drupal security advisory coverage.

Critical CSS

2,521 sites Security covered Drupal 10–11
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.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
10
Tracked since
Dec 2023
Latest release
1 month ago
Releases (12 mo)
4 ▲ from 3
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
2.0.7 Stable 10–11 Aug 26, 2026
2.0.6 Stable 10–11 Aug 21, 2026
2.0.5 Stable 9–11 Aug 21, 2026
2.0.4 Stable 9–11 Aug 21, 2026
2.0.3 Stable 9–11 Nov 5, 2024
2.0.2 Stable 9–11 Oct 29, 2024
2.0.1 Stable 9–11 Oct 29, 2024
2.0.0 Stable 9–10 Jan 18, 2024
2.0.x-dev Dev 10–11 Jan 18, 2024
8.x-1.20 Stable 9–11 Dec 29, 2023