You are here

function hook_advagg_css_contents_alter in Advanced CSS/JS Aggregation 8.2

Allow other modules to modify the contents of individual CSS files.

Called once per file at aggregation time.

Parameters

string $data: File contents. Depending on settings/modules these may be minified.

array $css_asset: Asset array.

See also

\Drupal\advagg\Asset\CssCollectionOptimizer::optimize()

Related topics

1 function implements hook_advagg_css_contents_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

advagg_mod_advagg_css_contents_alter in advagg_mod/advagg_mod.advagg.inc
Implements hook_advagg_css_contents_alter().
1 invocation of hook_advagg_css_contents_alter()
CssCollectionOptimizer::optimize in src/Asset/CssCollectionOptimizer.php
The cache file name is retrieved on a page load via a lookup variable that contains an associative array. The array key is the hash of the file names in $css while the value is the cache file name. The cache file is generated in two cases. First, if…

File

./advagg.api.php, line 102
Hooks provided by the AdvAgg module.

Code

function hook_advagg_css_contents_alter(&$data, array $css_asset) {

  // Remove all font-style rules applying italics.
  preg_replace("/(.*)(font-style\\s*:.*italic)(.*)/m", "\$0 --> \$1 \$3", $data);
}