Loading core/lib/Drupal/Core/Asset/AssetResolver.php +4 −0 Changes for core/lib/Drupal/Core/Asset/AssetResolver.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -138,6 +138,8 @@ public function getCssAssets(AttachedAssetsInterface $assets, $optimize, Languag if (isset($definition['css'])) { foreach ($definition['css'] as $options) { $options += $default_options; // Copy the asset library license information to each file. $options['license'] = $definition['license']; // Files with a query string cannot be preprocessed. if ($options['type'] === 'file' && $options['preprocess'] && strpos($options['data'], '?') !== FALSE) { Loading Loading @@ -244,6 +246,8 @@ public function getJsAssets(AttachedAssetsInterface $assets, $optimize, Language if (isset($definition['js'])) { foreach ($definition['js'] as $options) { $options += $default_options; // Copy the asset library license information to each file. $options['license'] = $definition['license']; // 'scope' is a calculated option, based on which libraries are // marked to be loaded from the header (see above). Loading core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php +8 −1 Changes for core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -124,7 +124,14 @@ public function optimize(array $css_assets, array $libraries) { if (empty($uri) || !file_exists($uri)) { // Optimize each asset within the group. $data = ''; $current_license = FALSE; foreach ($css_group['items'] as $css_asset) { // Ensure license information is available as a comment after // optimization. if ($css_asset['license'] !== $current_license) { $data .= "/* @license " . $css_asset['license']['name'] . " " . $css_asset['license']['url'] . " */\n"; } $current_license = $css_asset['license']; $data .= $this->optimizer->optimize($css_asset); } // Per the W3C specification at Loading @@ -138,7 +145,7 @@ public function optimize(array $css_assets, array $libraries) { REGEXP; preg_match_all($regexp, $data, $matches); $data = preg_replace($regexp, '', $data); $data = implode('', $matches[0]) . $data; $data = implode('', $matches[0]) . (!empty($matches[0]) ? "\n" : '') . $data; // Dump the optimized CSS for this group into an aggregate file. $uri = $this->dumper->dump($data, 'css'); // Set the URI for this group's aggregate file. Loading core/lib/Drupal/Core/Asset/CssCollectionOptimizerLazy.php +8 −1 Changes for core/lib/Drupal/Core/Asset/CssCollectionOptimizerLazy.php: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -160,7 +160,14 @@ public function deleteAll() { public function optimizeGroup(array $group): string { // Optimize each asset within the group. $data = ''; $current_license = FALSE; foreach ($group['items'] as $css_asset) { // Ensure license information is available as a comment after // optimization. if ($css_asset['license'] !== $current_license) { $data .= "/* @license " . $css_asset['license']['name'] . " " . $css_asset['license']['url'] . " */\n"; } $current_license = $css_asset['license']; $data .= $this->optimizer->optimize($css_asset); } // Per the W3C specification at Loading @@ -174,7 +181,7 @@ public function optimizeGroup(array $group): string { REGEXP; preg_match_all($regexp, $data, $matches); $data = preg_replace($regexp, '', $data); return implode('', $matches[0]) . $data; return implode('', $matches[0]) . (!empty($matches[0]) ? "\n" : '') . $data; } } core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php +7 −0 Changes for core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -124,7 +124,14 @@ public function optimize(array $js_assets, array $libraries) { if (empty($uri) || !file_exists($uri)) { // Concatenate each asset within the group. $data = ''; $current_license = FALSE; foreach ($js_group['items'] as $js_asset) { // Ensure license information is available as a comment after // optimization. if ($js_asset['license'] !== $current_license) { $data .= "/* @license " . $js_asset['license']['name'] . " " . $js_asset['license']['url'] . " */\n"; } $current_license = $js_asset['license']; // Optimize this JS file, but only if it's not yet minified. if (isset($js_asset['minified']) && $js_asset['minified']) { $data .= file_get_contents($js_asset['data']); Loading core/lib/Drupal/Core/Asset/JsCollectionOptimizerLazy.php +7 −0 Changes for core/lib/Drupal/Core/Asset/JsCollectionOptimizerLazy.php: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -172,7 +172,14 @@ public function deleteAll() { */ public function optimizeGroup(array $group): string { $data = ''; $current_license = FALSE; foreach ($group['items'] as $js_asset) { // Ensure license information is available as a comment after // optimization. if ($js_asset['license'] !== $current_license) { $data .= "/* @license " . $js_asset['license']['name'] . " " . $js_asset['license']['url'] . " */\n"; } $current_license = $js_asset['license']; // Optimize this JS file, but only if it's not yet minified. if (isset($js_asset['minified']) && $js_asset['minified']) { $data .= file_get_contents($js_asset['data']); Loading Loading
core/lib/Drupal/Core/Asset/AssetResolver.php +4 −0 Changes for core/lib/Drupal/Core/Asset/AssetResolver.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -138,6 +138,8 @@ public function getCssAssets(AttachedAssetsInterface $assets, $optimize, Languag if (isset($definition['css'])) { foreach ($definition['css'] as $options) { $options += $default_options; // Copy the asset library license information to each file. $options['license'] = $definition['license']; // Files with a query string cannot be preprocessed. if ($options['type'] === 'file' && $options['preprocess'] && strpos($options['data'], '?') !== FALSE) { Loading Loading @@ -244,6 +246,8 @@ public function getJsAssets(AttachedAssetsInterface $assets, $optimize, Language if (isset($definition['js'])) { foreach ($definition['js'] as $options) { $options += $default_options; // Copy the asset library license information to each file. $options['license'] = $definition['license']; // 'scope' is a calculated option, based on which libraries are // marked to be loaded from the header (see above). Loading
core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php +8 −1 Changes for core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -124,7 +124,14 @@ public function optimize(array $css_assets, array $libraries) { if (empty($uri) || !file_exists($uri)) { // Optimize each asset within the group. $data = ''; $current_license = FALSE; foreach ($css_group['items'] as $css_asset) { // Ensure license information is available as a comment after // optimization. if ($css_asset['license'] !== $current_license) { $data .= "/* @license " . $css_asset['license']['name'] . " " . $css_asset['license']['url'] . " */\n"; } $current_license = $css_asset['license']; $data .= $this->optimizer->optimize($css_asset); } // Per the W3C specification at Loading @@ -138,7 +145,7 @@ public function optimize(array $css_assets, array $libraries) { REGEXP; preg_match_all($regexp, $data, $matches); $data = preg_replace($regexp, '', $data); $data = implode('', $matches[0]) . $data; $data = implode('', $matches[0]) . (!empty($matches[0]) ? "\n" : '') . $data; // Dump the optimized CSS for this group into an aggregate file. $uri = $this->dumper->dump($data, 'css'); // Set the URI for this group's aggregate file. Loading
core/lib/Drupal/Core/Asset/CssCollectionOptimizerLazy.php +8 −1 Changes for core/lib/Drupal/Core/Asset/CssCollectionOptimizerLazy.php: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -160,7 +160,14 @@ public function deleteAll() { public function optimizeGroup(array $group): string { // Optimize each asset within the group. $data = ''; $current_license = FALSE; foreach ($group['items'] as $css_asset) { // Ensure license information is available as a comment after // optimization. if ($css_asset['license'] !== $current_license) { $data .= "/* @license " . $css_asset['license']['name'] . " " . $css_asset['license']['url'] . " */\n"; } $current_license = $css_asset['license']; $data .= $this->optimizer->optimize($css_asset); } // Per the W3C specification at Loading @@ -174,7 +181,7 @@ public function optimizeGroup(array $group): string { REGEXP; preg_match_all($regexp, $data, $matches); $data = preg_replace($regexp, '', $data); return implode('', $matches[0]) . $data; return implode('', $matches[0]) . (!empty($matches[0]) ? "\n" : '') . $data; } }
core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php +7 −0 Changes for core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -124,7 +124,14 @@ public function optimize(array $js_assets, array $libraries) { if (empty($uri) || !file_exists($uri)) { // Concatenate each asset within the group. $data = ''; $current_license = FALSE; foreach ($js_group['items'] as $js_asset) { // Ensure license information is available as a comment after // optimization. if ($js_asset['license'] !== $current_license) { $data .= "/* @license " . $js_asset['license']['name'] . " " . $js_asset['license']['url'] . " */\n"; } $current_license = $js_asset['license']; // Optimize this JS file, but only if it's not yet minified. if (isset($js_asset['minified']) && $js_asset['minified']) { $data .= file_get_contents($js_asset['data']); Loading
core/lib/Drupal/Core/Asset/JsCollectionOptimizerLazy.php +7 −0 Changes for core/lib/Drupal/Core/Asset/JsCollectionOptimizerLazy.php: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -172,7 +172,14 @@ public function deleteAll() { */ public function optimizeGroup(array $group): string { $data = ''; $current_license = FALSE; foreach ($group['items'] as $js_asset) { // Ensure license information is available as a comment after // optimization. if ($js_asset['license'] !== $current_license) { $data .= "/* @license " . $js_asset['license']['name'] . " " . $js_asset['license']['url'] . " */\n"; } $current_license = $js_asset['license']; // Optimize this JS file, but only if it's not yet minified. if (isset($js_asset['minified']) && $js_asset['minified']) { $data .= file_get_contents($js_asset['data']); Loading