mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-22 05:15:29 +09:00
Fix SCSS import from subdirectory
This commit is contained in:
parent
818a39f3e0
commit
1c43cbb126
1 changed files with 15 additions and 1 deletions
|
|
@ -333,7 +333,21 @@ class Formatter
|
||||||
$import_content = '';
|
$import_content = '';
|
||||||
$import_files = array_map(function($str) use($filename, $import_type) {
|
$import_files = array_map(function($str) use($filename, $import_type) {
|
||||||
$str = trim(trim(trim(preg_replace('/^url\\(([^()]+)\\)$/', '$1', trim($str))), '"\''));
|
$str = trim(trim(trim(preg_replace('/^url\\(([^()]+)\\)$/', '$1', trim($str))), '"\''));
|
||||||
return dirname($filename) . '/' . ($import_type === 'scss' ? "_$str.scss" : $str);
|
if ($import_type === 'scss')
|
||||||
|
{
|
||||||
|
if (($dirpos = strrpos($str, '/')) !== false)
|
||||||
|
{
|
||||||
|
return dirname($filename) . '/' . substr($str, 0, $dirpos) . '/_' . substr($str, $dirpos + 1) . '.scss';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return dirname($filename) . "/_$str.scss";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return dirname($filename) . '/' . $str;
|
||||||
|
}
|
||||||
}, explode(',', $matches[1]));
|
}, explode(',', $matches[1]));
|
||||||
foreach ($import_files as $import_filename)
|
foreach ($import_files as $import_filename)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue