Skip to content

Instantly share code, notes, and snippets.

@MichaelAllenWarner
Last active December 21, 2021 18:14
Show Gist options
  • Save MichaelAllenWarner/fd931eecf07992bd4628ccb525c9359e to your computer and use it in GitHub Desktop.
Save MichaelAllenWarner/fd931eecf07992bd4628ccb525c9359e to your computer and use it in GitHub Desktop.
diff --git a/core/lib/Drupal/Core/Asset/CssOptimizer.php b/core/lib/Drupal/Core/Asset/CssOptimizer.php
index 775603b633..93f2220c42 100644
--- a/core/lib/Drupal/Core/Asset/CssOptimizer.php
+++ b/core/lib/Drupal/Core/Asset/CssOptimizer.php
@@ -189,8 +189,8 @@ protected function processCss($contents, $optimize = FALSE) {
if ($optimize) {
// Perform some safe CSS optimizations.
- // Regexp to match comment blocks.
- $comment = '/\*[^*]*\*+(?:[^/*][^*]*\*+)*/';
+ // Regexp to match comment blocks, except for "/*!*/" (so that "/*!*/ /*!*/" is preserved).
+ $comment = '/\*(?!!\*/)[^*]*\*+(?:[^/*][^*]*\*+)*/';
// Regexp to match double quoted strings.
$double_quot = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"';
// Regexp to match single quoted strings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment