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

Called once per file at aggregation time.

Parameters

string $contents: Raw file data.

array $js_asset: Asset array.

See also

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

Related topics

1 invocation of hook_advagg_js_contents_alter()
JsCollectionOptimizer::optimize in src/Asset/JsCollectionOptimizer.php

File

./advagg.api.php, line 119

Code

function hook_advagg_js_contents_alter(&$contents, array $js_asset) {
    if ($js_asset['data'] == 'modules/advagg/advagg.admin.js') {
        $contents = str_replace('AdvAgg Bypass Cookie Removed', 'Advanced Aggregates Cookie Removed', $contents);
    }
}