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

Asset Minifier Bundle Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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.

  1. Require the package via Composer and register the bundle in config/bundles.php (nothing new is needed for v1.7.0 — both new options default to true).
  2. Confirm your assets are being picked up. Vendor CSS is intentionally skipped, so start by checking that the file you expect minified lives in your own asset paths and not in vendor/.
  3. First use case: pair it with 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

Implementation Patterns

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.

Gotchas and Tips

  • Colour formats are deliberately not optimised. The minifier runs with --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.
  • Shorthand merging can shift the cascade. Four 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.
  • Vendor CSS is skipped silently. If a third-party stylesheet ships unminified and you assumed this bundle would handle it, it won't. Either take the upstream minified build or copy the file into your own asset paths.
  • Debugging stale output. If minified CSS looks wrong, check the order of operations first: Tailwind must compile before minification runs. A stale Tailwind build gets minified faithfully and looks like a minifier bug. Clear the Symfony cache after changing asset_minifier config — YAML changes are not always picked up hot.
  • No breaking changes. Both flags default to 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.
  • Extension points are thin. Beyond the two booleans there is nothing to hook into; if you need custom esbuild flags (targets, sourcemaps, external), you'll be maintaining your own build step rather than extending this bundle.
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.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core