Issue #3019393 by hugovk, PapaGrande: Avoid query strings for aggregated CSS files (like JS)

merge-requests/55/head
catch 2019-07-29 12:48:23 +01:00
parent 97eb1ad748
commit 7cbb0ca739
1 changed files with 7 additions and 4 deletions

View File

@ -55,10 +55,13 @@ class CssCollectionRenderer implements AssetCollectionRendererInterface {
switch ($css_asset['type']) {
// For file items, output a LINK tag for file CSS assets.
case 'file':
// The dummy query string needs to be added to the URL to control
// browser-caching.
$query_string_separator = (strpos($css_asset['data'], '?') !== FALSE) ? '&' : '?';
$element['#attributes']['href'] = file_url_transform_relative(file_create_url($css_asset['data'])) . $query_string_separator . $query_string;
$element['#attributes']['href'] = file_url_transform_relative(file_create_url($css_asset['data']));
// Only add the cache-busting query string if this isn't an aggregate
// file.
if (!isset($css_asset['preprocessed'])) {
$query_string_separator = (strpos($css_asset['data'], '?') !== FALSE) ? '&' : '?';
$element['#attributes']['href'] .= $query_string_separator . $query_string;
}
break;
case 'external':