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

INTRODUCTION
* 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")


* If none of the previous filenames can be found, this module will search for a file named "default-critical.css".
* A hook is provided ("critical_css_file_paths_suggestion") in case another filename is needed.
* If any of the above paths is found, this module loads the CSS file contents inside a <style> tag placed in the HTML head.
* 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.

Project Usage
1448
Creation Date
Changed Date
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
This module embeds a critical CSS file into a page's HTML head and loads the rest of non-critical CSS asynchronously.
Data Name
critical_css

OPENAI CHATBOT

OPENAI CHATBOT

12:20:41
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.