Skip to content

Commit f446d71

Browse files
authored
Update Less Analyzer to be able to handle imports of files
Related to magento#73 - option 2, if you wish to see a more indepth writeup The Less Analyzer class cannot handle Less files that import css as the object they convert into mean the $node->path->value is a Link_Tree_Quoted object and not a string castable value, so we add an additional check for if we are a CSS quoted file or if value is an object which contains another value and use that instead (In the off chance similar future issues may arise with new objects)
1 parent 1aaf057 commit f446d71

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Analyzer/Less/Analyzer.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ private function getNodes(LessRegistry $registry): array
128128
if (property_exists($node, 'name')) {
129129
$nodeKey = $node->name;
130130
} elseif (property_exists($node, 'type') && property_exists($node, 'path')) {
131-
$nodeKey = $node->type . ' with value: \'' . $node->path->value . '\'';
131+
if ($node->path->value instanceof \Less_Tree_Quoted || property_exists($node->path->value, 'value')) {
132+
$nodeKey = $node->type . ' with value: \'' . $node->path->value->value . '\'';
133+
} else {
134+
$nodeKey = $node->type . ' with value: \'' . $node->path->value . '\'';
135+
}
132136
} else {
133137
$nodeKey = get_class($node);
134138
}

0 commit comments

Comments
 (0)