Skip to content

Commit 81d73b3

Browse files
committed
Merge branch '2.x-dev' into improved-navigation-internals
2 parents 139c110 + 244739f commit 81d73b3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

monorepo/CodeIntelligence/CodeIntelligence.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,24 @@ protected function findBladeElementClasses(): array
496496
$classes = [];
497497

498498
foreach ($this->bladeFiles as $contents) {
499+
// Extract static classes from dynamic Alpine.js classes containing boolean logic
500+
$contents = preg_replace_callback('/:class=(["\'])(.*?)\1/', function (array $matches): string {
501+
$staticClasses = '';
502+
$dynamicClasses = $matches[2];
503+
504+
// Parse the dynamic classes to separate static classes
505+
preg_match_all('/\'\s*([^\'\s]*)\s*\'/', $dynamicClasses, $staticMatches);
506+
if (! empty($staticMatches[1])) {
507+
$staticClasses = sprintf('class="%s"', implode(' ', $staticMatches[1]));
508+
}
509+
510+
return $staticClasses;
511+
}, $contents);
512+
499513
$matches = [];
514+
500515
preg_match_all('/class="([^"]+)"/', $contents, $matches);
516+
501517
foreach ($matches[1] as $match) {
502518
$match = explode(' ', $match);
503519
foreach ($match as $class) {

0 commit comments

Comments
 (0)