Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Blade Tailwind Extract Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Performance Optimization for Livewire Apps: Reduces wire transfer payloads by replacing verbose Tailwind class strings with compact CSS class names, directly addressing slow component updates in Livewire-heavy applications.
  • Build vs. Buy Decision: Eliminates the need to manually refactor Tailwind classes, saving engineering time while maintaining Tailwind’s utility-first benefits.
  • Roadmap for Scalable Frontends: Enables teams to adopt Livewire at scale without sacrificing performance, aligning with Laravel’s ecosystem growth.
  • Developer Experience (DX) for Tailwind + Livewire: Streamlines the workflow for frontend teams by automating repetitive class extraction/restoration, reducing cognitive load during development.
  • Use Cases:
    • Large-scale Livewire applications with frequent component updates (e.g., dashboards, admin panels).
    • Projects where Tailwind’s utility classes lead to bloated payloads (e.g., lists, grids, or dynamic UI).
    • Teams prioritizing performance optimization without sacrificing Tailwind’s flexibility.

When to Consider This Package

  • Adopt if:

    • Your Laravel/Livewire app suffers from slow component updates due to verbose Tailwind class strings.
    • You frequently reuse identical Tailwind class lists across Blade templates (e.g., cards, modals, buttons).
    • Your team values automation over manual refactoring for repetitive tasks.
    • You’re using Tailwind CSS with Livewire and need to optimize wire payloads without migrating to a CSS-in-JS solution.
  • Look elsewhere if:

    • Your app doesn’t use Livewire or has minimal dynamic UI updates (payload size impact is negligible).
    • You’re already using a CSS-in-JS solution (e.g., Tailwind with @layer or a custom build process).
    • Your team prefers manual control over class extraction (e.g., for complex styling logic).
    • You’re using a non-Laravel/PHP stack (this package is Laravel-specific).
    • Your Tailwind classes are heavily dynamic (e.g., generated via JavaScript) and can’t be statically extracted.

How to Pitch It (Stakeholders)

For Executives: "This package automates the optimization of Livewire component performance by reducing the size of data transferred between the server and client. For apps with heavy Livewire usage—like dashboards or admin panels—this can cut payload sizes by 30-50%, directly improving responsiveness and user experience. It’s a low-risk, high-reward tool that requires no architectural changes, just a one-time setup. Think of it as ‘automated code golf’ for your frontend: smaller payloads, faster updates, and happier users."

For Engineering Teams: "If you’re tired of bloated Livewire wire transfers from long Tailwind class strings, this package replaces them with compact CSS classes during build time. It supports all major Blade/Livewire/Alpine patterns, handles edge cases (like reserved Tailwind classes), and integrates seamlessly into your Laravel workflow. The wrap command auto-detects reusable class lists, while extract and restore commands let you toggle between development (readable) and production (optimized) modes. No more manual refactoring—just run a CLI command and let it handle the heavy lifting. Perfect for teams prioritizing performance without sacrificing Tailwind’s flexibility."

For Developers: *"This is like Tailwind’s @apply on steroids for Livewire. Instead of manually extracting classes into CSS, you can:

  1. Wrap: Auto-generate semantic placeholders for reusable class lists (e.g., __card-wrapper__).
  2. Extract: Convert those placeholders into short CSS classes (e.g., TW-a40f-card-wrapper) with @apply rules.
  3. Restore: Bring classes back inline for editing. It handles all class patterns (class="", wire:class, :class, @class, etc.), skips reserved Tailwind classes, and even deduplicates identical lists across files. The CLI commands are intuitive, and the package plays nice with your existing Tailwind setup. Try it on a Livewire-heavy component—you’ll see the payload shrink instantly."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log