Skip to content

Commit 7daa881

Browse files
authored
Update MagentoImport.php
1 parent addd68b commit 7daa881

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/internal/Magento/Framework/Css/PreProcessor/Instruction/MagentoImport.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,21 +138,26 @@ protected function replace(array $matchedContent, LocalInterface $asset)
138138
/** @var $importFile \Magento\Framework\View\File */
139139
foreach ($importFiles as $importFile) {
140140
$moduleName = $importFile->getModule();
141+
$referenceString = $isReference ? '(reference) ' : '';
141142

142143
if (!$deployOnlyEnabled) {
143-
$referenceString = $isReference ? '(reference) ' : '';
144144
$importsContent .= $moduleName
145145
? "@import $referenceString'{$moduleName}::{$resolvedPath}';\n"
146146
: "@import $referenceString'{$matchedFileId}';\n";
147147
}
148148

149149
if ($deployOnlyEnabled) {
150-
if ($moduleName && !$this->moduleManager->isEnabled($moduleName)) {
150+
if (($moduleName && !$this->moduleManager->isEnabled($moduleName)) ||
151+
"" === ($matchedFileId) ||
152+
null === ($matchedFileId)) {
151153
continue;
152154
}
153155

156+
if (!$moduleName && !empty($matchedFileId)) {
157+
$importsContent .= "@import $referenceString'{$matchedFileId}';\n";
158+
}
159+
154160
if ($moduleName && $this->moduleManager->isEnabled($moduleName)) {
155-
$referenceString = $isReference ? '(reference) ' : '';
156161
$importsContent .= $moduleName
157162
? "@import $referenceString'{$moduleName}::{$resolvedPath}';\n"
158163
: "@import $referenceString'{$matchedFileId}';\n";

0 commit comments

Comments
 (0)