mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Fix #1729 @import of external URL in concatenated CSS
This commit is contained in:
parent
858b3f68b1
commit
b01a148675
4 changed files with 15 additions and 1 deletions
|
|
@ -339,6 +339,10 @@ class Formatter
|
|||
$import_content = '';
|
||||
$import_files = array_map(function($str) use($filename, $import_type) {
|
||||
$str = trim(trim(trim(preg_replace('/^url\\(([^()]+)\\)$/', '$1', trim($str))), '"\''));
|
||||
if (preg_match('!^(https?:)?//!i', $str))
|
||||
{
|
||||
return $str;
|
||||
}
|
||||
if ($import_type === 'scss')
|
||||
{
|
||||
if (($dirpos = strrpos($str, '/')) !== false)
|
||||
|
|
@ -367,10 +371,14 @@ class Formatter
|
|||
}, explode(',', $matches[1]));
|
||||
foreach ($import_files as $import_filename)
|
||||
{
|
||||
if (file_exists($import_filename))
|
||||
if (!preg_match('!^(https?:)?//!i', $import_filename) && file_exists($import_filename))
|
||||
{
|
||||
$import_content .= self::concatCSS($import_filename, $target_filename, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$import_content .= '@import url("' . escape_dqstr($import_filename) . '");';
|
||||
}
|
||||
}
|
||||
return trim($import_content);
|
||||
}, $content);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
@charset "UTF-8";
|
||||
@import url(concat.source3.css);
|
||||
@import url(//fonts.googleapis.com/earlyaccess/nanumgothic.css);
|
||||
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR&display=swap');
|
||||
.wordpress {
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
background-image: url("../_data/_data/formatter/test.jpg");
|
||||
font-family: sans-serif;
|
||||
}
|
||||
@import url("//fonts.googleapis.com/earlyaccess/nanumgothic.css");
|
||||
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR&display=swap");
|
||||
.wordpress {
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
background-image: url("../_data/_data/formatter/test.jpg");
|
||||
font-family: sans-serif;
|
||||
}
|
||||
@import url("//fonts.googleapis.com/earlyaccess/nanumgothic.css");
|
||||
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR&display=swap");
|
||||
.wordpress {
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue