Issue #3317745 by heykarthikwithu, mkalkbrenner, catch, smustgrave, Schoenef: CSS Aggregation should not rewrite # url
parent
9d3c52dd80
commit
5f07e3ce56
|
@ -90,8 +90,8 @@ class CssOptimizer implements AssetOptimizerInterface {
|
||||||
// Store base path.
|
// Store base path.
|
||||||
$this->rewriteFileURIBasePath = $css_base_path . '/';
|
$this->rewriteFileURIBasePath = $css_base_path . '/';
|
||||||
|
|
||||||
// Anchor all paths in the CSS with its base URL, ignoring external and absolute paths.
|
// Anchor all paths in the CSS with its base URL, ignoring external and absolute paths and paths starting with '#'.
|
||||||
return preg_replace_callback('/url\(\s*[\'"]?(?![a-z]+:|\/+)([^\'")]+)[\'"]?\s*\)/i', [$this, 'rewriteFileURI'], $contents);
|
return preg_replace_callback('/url\(\s*[\'"]?(?![a-z]+:|\/+|#|%23)([^\'")]+)[\'"]?\s*\)/i', [$this, 'rewriteFileURI'], $contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -222,6 +222,18 @@ class CssOptimizerUnitTest extends UnitTestCase {
|
||||||
],
|
],
|
||||||
file_get_contents($absolute_path . 'quotes.css.optimized.css'),
|
file_get_contents($absolute_path . 'quotes.css.optimized.css'),
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'group' => -100,
|
||||||
|
'type' => 'file',
|
||||||
|
'weight' => 0.013,
|
||||||
|
'media' => 'all',
|
||||||
|
'preprocess' => TRUE,
|
||||||
|
'data' => $path . 'import3.css',
|
||||||
|
'basename' => 'import3.css',
|
||||||
|
],
|
||||||
|
file_get_contents($absolute_path . 'import3.css.optimized.css'),
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
div {
|
||||||
|
clip-path: url('#clip-cloud');
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
clip-path: url('/abc/#clip-cloud');
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
div{clip-path:url('#clip-cloud');}div{clip-path:url('/abc/#clip-cloud');}
|
Loading…
Reference in New Issue