dxgx/blade-tailwind-extract
Laravel package that shrinks Livewire payloads by extracting long Tailwind class strings from Blade/Livewire into short hashed class names and a generated @apply CSS file. Supports class="", @class/->class arrays, dev inject vs prod extract, and collision-safe hashing.
group* and peer* classes are now automatically moved outside wrapper markers and extraction instead of skipping the entire pattern, preventing CSS parent-child selector breakagegroup, group/, group-*:, group-*/, peer, peer/, peer-*:, peer-*/ReservedClassesMovingTest: 12 tests validating extraction with automatic separationWrapReservedClassesTest: 13 tests validating wrap command with automatic separationisReservedClass() method: Checks if a class matches any reserved patternseparateReservedClasses() method: Separates classes into extractable and reserved groupswrapIfNeeded(), processAtClassConditionals(), processClassTernary()) now separate reserved classes before checking minimum thresholdextractFromClassAttributes(), extractFromClassMethod(), extractFromAtClassDirective()) now use separation logic instead of skip logic[@apply](https://github.com/apply) rules; reserved classes remain inline after generated class nameblade-tailwind-extract.search_path → dg-blade-tailwind-extract.search_path) and confirmation expectation typesgroup-hover.blade.php), so tests now validate only rule bodiesTW-242f-card and TW-242f-card-shadow now restore correctly without corruption){{ }}) to preserve dynamic behaviorinjectIntoClassAttributes, injectIntoClassMethod, injectIntoAtClassDirective) now use uksort() to sort rules by class name length before processingclass="", wire:class="", :class, [@class](https://github.com/class)[] patterns{{ }} interpolation{{ }} check) in wrapIfNeeded(), processAtClassConditionals(), and processClassTernary() methodsclass="" and [@class](https://github.com/class)([...]) attributes to properly handle Tailwind arbitrary values containing quotes (e.g., after:content-[''], before:content-[""])[@class](https://github.com/class) directives now use separate patterns for double-quoted and single-quoted attributes to prevent early quote matching__ marker now correctly appears at the end of class lists instead of breaking inside arbitrary values:class ternary expression support: Wrap command now processes both branches of ternary expressions independently (e.g., :class="condition ? 'classes-a' : 'classes-b'")[@class](https://github.com/class) conditional array support: All conditional strings in [@class](https://github.com/class)([...]) arrays are now processed, not just the first one:class static binding support: Static class strings in :class attributes are now wrapped alongside ternary expressionsx-bind:class support: Explicit Alpine binding syntax now fully supported[@class](https://github.com/class) conditionals and :class ternaries are processed before simple patternsclass and wire:class patterns now explicitly exclude dynamic :class patterns to prevent conflicts:class attributes are now processed separately for proper nested quote handlingprocessAtClassConditionals() method for handling all strings within [@class](https://github.com/class)([...]) arraysprocessClassTernary() and processClassTernaryMatch() methods for ternary expression processinggroup-hover:, peer-focus:, group-active:, peer-checked:, and all other dash-colon variants (e.g., group-*:, peer-*:) that break parent-child/sibling relationships when extractedgroup and peer classesgroup/ variant detection (e.g., group/item, group/card)containsReservedClasses() method now checks for both exact class matches and slash variantsdg:blade-tailwind:restore now removes restored CSS rules from the output fileremoveRestoredClassesFromCss() method in TailwindExtractorService for cleaning up CSS rulesinject() method now returns restored_classes array with list of all restored class nameshover:bg-[var(--secondary-color)], bg-[#1da1f2], text-[rgb(255,0,0)], etc.#, ,, and % to allowed validation regex for arbitrary value supportdg:blade-tailwind:wrap command for automated class list identification and marking__adjective-noun-number__ format (e.g., __happy-cat-1__)__, material-symbols-outlined, and TW- prefixes--min: Configurable minimum class count (default: 3)--skip-prefix: Skip class lists with specified prefix (default: TW)--dry-run: Preview changes without modifying filesclass="", [@class](https://github.com/class)([...]), and wire/x-bind class attributesdg:blade-tailwind:extract - for extraction only (replaces old dg:blade-tailwind-extract extract and e alias)dg:blade-tailwind:restore - for restoration only (replaces old dg:blade-tailwind-extract inject and r alias)BladeTailwindRestoreCommand class for restoration operationsHandlesBulkOperations trait for shared command functionalityBladeTailwindExtractCommand to handle extraction onlyHandlesBulkOperations traitphp -l) runs before extraction to catch syntax errors early__name__ classes __) are shown in confirmation listhasExtractablePatterns() method in TailwindExtractorService to check for extractable contentlintPhpFiles() method in command to validate PHP syntaxgetBladeFiles() method public in TailwindExtractorService for better testabilityclass="", ->class([...]), and [@class](https://github.com/class)([...]) syntaxesdgtool:blade-tailwind-extractHow can I help you explore Laravel packages today?