critical_css.module in Critical CSS 8
A module to inline a critical CSS file in HTML head.
File
critical_css.moduleView source
<?php
/**
* @file
* A module to inline a critical CSS file in HTML head.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function critical_css_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.critical_css':
$output = '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The Critical CSS module embeds critical CSS file into a page\'s HTML head, and loads the rest of non-critical CSS asynchronously. For more information, see the <a href=":documentation">online documentation for the Critical CSS module</a>.', [
':documentation' => 'https://www.drupal.org/project/critical_css',
]) . '</p>';
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Speeding up your site') . '</dt>';
$output .= '<dd>' . t('Administrators can define, on the <a href=":config_page">Critical CSS</a> page where this module should look when trying to find a matching critical CSS files. There are some options that alter that search to accommodate it to your needs.', [
':config_page' => "/admin/config/development/performance/critical-css",
]) . '</dd>';
$output .= '</dl>';
return $output;
}
}
Functions
Name | Description |
---|---|
critical_css_help | Implements hook_help(). |