halimjr/asset-minifier-bundle
Asset Minifier Bundle is a PHP package for minifying CSS and JavaScript assets, helping reduce file sizes and improve page load performance. It provides a simple way to add asset compression to your application with minimal configuration.
This release adds CSS minification alongside the existing JS minification. Note up front that this is a Symfony bundle, not a Laravel package — configuration lives in config/packages/asset_minifier.yaml, and there is no config/*.php service-provider wiring. If you are in a Laravel codebase, you almost certainly want Vite instead; read the rest of this as guidance for Symfony projects in a mixed portfolio.
config/bundles.php (nothing new is needed for v1.7.0 — both new options default to true).vendor/.symfonycasts/tailwind-bundle. Tailwind compiles first, esbuild minifies the compiled output — you get a single pipeline with no extra build step.The only configuration you may want to touch:
# config/packages/asset_minifier.yaml
asset_minifier:
minify_js: true
minify_css: true
Tailwind pipeline (the headline integration). Install symfonycasts/tailwind-bundle, let it compile, and let this bundle minify the result. No custom esbuild flags, no post-processing script.
Per-environment toggling. Keep CSS minification off in dev for readable output and on in prod:
# config/packages/asset_minifier.yaml
asset_minifier:
minify_css: true
# config/packages/dev/asset_minifier.yaml
asset_minifier:
minify_css: false
Selective opt-out. If a legacy stylesheet breaks under shorthand merging, disable CSS minification globally rather than trying to exclude a single file — there is no per-file allowlist in this release.
CI verification. Since the feature is on by default, a build that previously emitted unminified CSS will now emit minified CSS. Add an assertion on output size or a snapshot diff in CI the first time you upgrade so the change is visible rather than silent.
--supported:hex-rgba=false, so rgba() stays rgba() and hsl() stays hsl(). This avoids browser-compat breakage but means your byte savings are smaller than a naive minifier would suggest — don't quote "X% smaller" numbers from generic esbuild benchmarks.margin-* declarations collapsing into one margin is usually safe, but if a later rule overrides a single longhand with different specificity, the merged declaration can win where it previously lost. Do a visual pass on any stylesheet that mixes shorthand and longhand margin/padding rules.asset_minifier config — YAML changes are not always picked up hot.true and existing behaviour for JS is unchanged, so upgrading is a no-op for configuration. The behavioural change is that CSS is now minified where it previously wasn't — that's the only thing to regression-test.How can I help you explore Laravel packages today?