- How does this package reduce Livewire payload size?
- The package replaces long Tailwind class strings in Blade templates with short hashed class names (e.g., `TW-a40f-card-wrapper`) and generates a CSS file with `@apply` rules. This drastically cuts the wire payload size when Livewire components update, especially for components with repeated class-heavy markup.
- Can I use this package without Livewire?
- While the package is optimized for Livewire payload reduction, it works with any Blade template. If you're not using Livewire, the benefits are limited to CSS optimization via `@apply`, but the extraction process still applies to static Blade files.
- What Laravel versions does this package support?
- The package supports Laravel 9.x and 10.x. Check the [GitHub repository](https://github.com/dxgx/blade-tailwind-extract) for the latest compatibility details, as newer Laravel releases may require updates to align with Blade or Artisan changes.
- How do I install and configure this package?
- Install via Composer: `composer require dxgx/blade-tailwind-extract`. Publish the config (optional) with `php artisan vendor:publish --tag=blade-tailwind-extract-config`. No additional setup is required unless you need to customize reserved classes or hashing behavior.
- Will this break my existing Tailwind configuration?
- No, the package works alongside your existing Tailwind setup. It doesn’t modify your `tailwind.config.js` or JIT mode. The generated CSS is standalone and can be merged into your existing build process (e.g., Vite or Laravel Mix).
- What happens if I manually edit a Blade file after extraction?
- Manually editing extracted Blade files (e.g., renaming or moving them) can invalidate the CSS hashes, causing styling issues. Always use `php artisan dg:blade-tailwind:restore` before editing and re-extract afterward. The package includes safeguards to skip reserved classes like `group` or `peer` to avoid Tailwind conflicts.
- How do I integrate this into my CI/CD pipeline?
- In development, use `restore` before editing Blade files and `extract` before commits. In production, ensure `extract` runs as part of your build/deploy process. The package provides Artisan commands for seamless integration, and you can automate it using Laravel Forge, GitHub Actions, or other CI tools.
- Does this package work with Alpine.js or other frontend frameworks?
- Yes, the package supports all Blade class patterns, including Alpine.js bindings like `x-bind:class` or `@class([])`. It’s framework-agnostic for the Blade layer but optimized for Tailwind CSS’s `@apply` feature. Just ensure your class lists are compatible with Tailwind’s syntax.
- Are there any performance concerns during extraction?
- The initial extraction (`wrap` and `extract` commands) may introduce latency for large codebases due to deduplication logic. However, this is a one-time cost per file. Subsequent runs are fast, and the package is designed to be efficient for repeated use in CI/CD pipelines.
- What alternatives exist for reducing Livewire payload size?
- Alternatives include manually shortening Tailwind classes, using Laravel Mix/Vite to inline critical CSS, or leveraging Livewire’s `wire:ignore` for static content. However, this package uniquely automates the process for Tailwind users, ensuring collision-safe hashing and bidirectional workflows (dev vs. prod).