[Bug] MinifyHtml aggressively strips quotes from Alpine.js "x-data" attributes in Production
**Hi there,**
I have a simple problem. My Alpine.js code works 100% in **Local**, but breaks in **Production**.
**The Problem:**
When `APP_DEBUG=false` (Production), the `MinifyHtml` middleware seems to remove important quotes in Alpine attributes.
**Example:**
Original code in Blade:
```html
<div x-data="{ open: false }">
```
Result in Browser (Production):
```html
<div x-data={open:false}>
```
Because the quotes are gone, Alpine.js cannot read it and throws an error.
**How to reproduce:**
1. Use Laravel 12 + Alpine.js (Vite).
2. Enable `MinifyHtml::class` in `bootstrap/app.php`.
3. Set `.env` to `APP_ENV=production` and `APP_DEBUG=false`.
4. The Alpine component stops working.
**My Fix:**
I have to disable `MinifyHtml` to make it work again.
Please fix how the minifier handles attributes with JSON strings like `x-data`. Thank you!
1 条评论