Skip to content

Commit

Permalink
Fix issue load Google Font API when minify CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed Dec 2, 2022
1 parent c0011d3 commit 594b224
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion framework/library/astroid/Document.php
Expand Up @@ -218,8 +218,10 @@ public function minifyCSS($html)
$stylesheetLinks = [];
$stylesheetsUrls = [];
$html = preg_replace_callback('/(<link\s[^>]*href=")([^"]*)("[^>][^>]*rel=")([^"]*)("[^>]*\/>)/siU', function ($matches) use (&$stylesheetLinks, &$stylesheetsUrls) {

if (isset($matches[4]) && $matches[4] === 'stylesheet') {
if (strpos($matches[2], 'fonts.googleapis.com') > 0) {
return $matches[0];
}
$url = $this->_cssPath($matches[2]);
$ext = pathinfo($url, PATHINFO_EXTENSION);
if ($ext !== 'css' && !Helper::startsWith($url, '@import')) return $matches[0];
Expand Down

0 comments on commit 594b224

Please sign in to comment.