alleyinteractive/wp-asset-manager
A WordPress library for registering and enqueueing theme and plugin assets from build-tool manifests, handling versioning, dependencies, and cache busting so compiled scripts and styles load reliably.
am_preload() now accepts imagesrcset, imagesizes, and fetchpriority, so responsive-image LCP preloading is a first-class capability rather than a hand-rolled <link> tag. If Core Web Vitals or LCP targets are on the roadmap, this is the concrete lever to schedule.async/defer through the strategy argument, and this release deletes the plugin's own pre-6.3 fallback accordingly. What remains uniquely valuable is: preload hint generation (including responsive variants), correct dependency ordering for assets the plugin prints itself, SVG sprite management, and structured asset-error surfacing. Price the build option against those four things, not against async/defer generally.am → wp-asset-manager), and removal of the async-defer load method, Scripts::$async_scripts/add_to_async()/add_attributes()/disable_concat()/manage_async(), Asset_Manager::$assets_by_dependency/$assets_manual, and the preload style method. Anyone on PHP 8.0–8.2 cannot take this release at all — that is an infrastructure decision, not a library decision.am_modify_load_method() was silently failing to apply async/defer on WordPress 6.3+ (#62). Any team that believed they were shipping deferred scripts on a modern WP may not have been. Audit current behaviour before and after the upgrade — the performance delta may be positive and unexpected, or may reveal that prior benchmarks were measuring nothing.wp_enqueue_* and previously never reached core dependency resolution. This is the kind of fix that removes a class of intermittent, environment-specific breakage — worth calling out as a reason to upgrade rather than defer.defer method for stylesheets now behaves as async: previously deferred CSS began downloading after DOMContentLoaded; now it begins during HTML parsing. The bundled loadCSS library (archived upstream) is no longer shipped or auto-enqueued. Expect a measurable change in first-paint and layout-shift metrics on any page relying on deferred CSS — this needs a before/after measurement, not an assumption.am_* template tags. They will be formally deprecated in the next major. Any theme or plugin code calling them should be scheduled for replacement now, while 2.x keeps them working, rather than during a future forced upgrade.phpcs.xml.dist for local overrides, and CONTRIBUTING.md all indicate an actively maintained dependency rather than an abandoned one. That is a genuine procurement input when comparing against an internal build.Adopt when:
imagesrcset/imagesizes/fetchpriority) as part of an LCP strategy — this is the clearest capability gap versus core.safe_style_css handling and symbol creation that does not emit warnings on every rendered page.invalid_enqueue_function branch.Look elsewhere, or stay put, when:
async/defer on scripts — WordPress core's strategy argument covers this natively, and this release removes the plugin's own fallback for exactly that reason. Do not carry a dependency for a solved problem.Scripts::add_to_async(), manage_async(), disable_concat(), $assets_by_dependency, $assets_manual, the preload style method, or the bundled loadCSS library. Migration precedes adoption here.am to wp-asset-manager; existing translation files under the old domain will not resolve. Budget for re-translation.defer → async timing shift without measuring it first.To executives: This is a maintenance-driven major upgrade of a small, actively maintained WordPress asset library, and the headline is risk reduction rather than new capability. It fixes a bug where async/defer script loading had been silently not applying on modern WordPress, and it fixes a fatal error path that could take down admin-visible asset pages. It also fixes a warning that fired on every rendered page for sites using SVG sprites. The cost is an infrastructure prerequisite — PHP 8.3 and WordPress 6.3 — plus a bounded set of removed legacy APIs. There is one genuine new capability worth funding: responsive-image preloading with fetchpriority, which maps directly to LCP and Core Web Vitals. Recommendation: treat this as a scheduled upgrade tied to the PHP 8.3+ platform work, not a standalone project.
To engineering: v2.0.0 is a clean major that deletes the pre-6.3 async/defer fallback in favour of core's strategy argument, so the library's surface shrinks in a good way. Four things to plan for: (1) the PHP 8.3 / WP 6.3 floor; (2) the text-domain rename, which invalidates existing .mo files under am; (3) the defer-for-stylesheets method now behaving as async, with a _doing_it_wrong() notice and a real change in fetch timing — measure first paint and CLS before and after; and (4) removal of Scripts::add_to_async()/manage_async()/add_attributes()/disable_concat() and the loadCSS library. In exchange you get correct transitive dependency ordering for inline/async/defer assets, working am_modify_load_method() on 6.3+, array|string accepted consistently across am_* helpers, and a batch of fatal-error and null-destructuring fixes. The repo is now at PHPStan level 9 with CI on PHP 8.3–8.5 and a dedicated minimum-WP job, so future upgrades should be cheaper. Start migrating off am_* template tags now — they are on the deprecation path for the next major.
How can I help you explore Laravel packages today?