File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
monorepo/CodeIntelligence Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments