norman-huth/nova-assets-versioning
A Laravel Nova package for versioning Nova frontend assets, helping prevent stale cached CSS and JavaScript after deployments by serving versioned asset URLs for reliable cache busting.
This package does one narrow job: it lets you append a cache-busting version marker to Nova's compiled CSS/JS URLs so that browsers and proxies fetch fresh admin assets after a Nova upgrade or a custom tool rebuild. That is the entire day-to-day value; treat it as infrastructure glue, not a feature package.
Because the repository is archived, your first stop is the README's "maintained alternatives" note, not the code. If you still proceed:
composer.json ("norman-huth/nova-assets-versioning": "x.y.z") — an archived package with 0 dependents will not receive Nova/PHP compatibility patches.php artisan vendor:publish --tag=nova-assets-versioning-config).config/nova-assets-versioning.php first. That file is the whole API surface: an enable switch and the version value/source. Read the service provider next to see exactly which Nova asset URLs it rewrites./nova in a private window. Your first use case is the canonical one: a Nova upgrade ships, users report "the admin looks broken," and you bump the version so their cached JS/CSS is replaced without asking them to hard-refresh.Verify the result in the rendered HTML (<script src=".../nova-api/scripts/...?v=...">) and in the Network tab, not in the source.
Environment-driven version string. The simplest reliable pattern is an env value that changes on every deploy:
NOVA_ASSETS_VERSION=${GIT_SHA}
Set it from your deploy script (Git SHA, build number, or release tag). A stable value per release means the query string changes exactly when assets might have changed — no gratuitous cache misses and no stale assets.
Content-derived version. If the package supports deriving the version from the published Nova directory (filemtime or hash), prefer a content hash over mtime: mtime is unreliable across rsync --times, symlink-swapped releases, and container image layers. If only mtime is offered, use a hash you compute yourself and feed it in via config.
Deploy hook. Wire the version bump into the same step that runs php artisan nova:publish and php artisan config:cache. A version bump that happens before config:cache is silently discarded because the cached config wins at runtime.
Custom tools, cards, and fields. Nova tool/card/field assets are registered through Nova's own script/style helpers. Confirm the package patches those URLs too (it hooks Nova's asset registration, not arbitrary <script> tags), and test one custom card after a rebuild — that is where stale assets actually bite, since third-party tool JS is the usual culprit for "works for me, broken for the client."
CDN/proxy alignment. Query-string busting only helps if your CDN and any reverse proxy include the query string in the cache key (Cloudflare does by default; some S3/CloudFront and nginx configurations strip or ignore it). Where you control the origin, purge the /nova-api/scripts/* and /nova-api/styles/* paths on deploy in addition to versioning — belt and braces.
Local vs production. Disable versioning locally if you are watching Nova tool assets with npm run watch; a fixed version string plus a long browser cache is a debugging tax. Keep it on in staging so you exercise the same path as production.
Nova::script/Nova::style override may be a cheaper, safer replacement than a dead dependency..env, run php artisan config:clear (or re-run config:cache) — otherwise you will "prove" the package does nothing while staring at a stale cached config.immutable + long max-age in every cache. Some intermediaries and older proxies ignore query strings for cache keying. Check the actual Cache-Control/ETag headers with curl -I against your deployment before assuming the problem is solved./nova-api/scripts/foo directly will not be versioned. Grep your codebase for those paths during rollout.composer show and php artisan about and test with the other package disabled.?v= parameter → confirm the config value at runtime (php artisan tinker, config('nova-assets-versioning')) → confirm no config cache → check response headers → test in a private window. If the parameter never appears, the service provider is almost certainly not registered (package discovery disabled, or a dont-discover entry)..env and deploy scripts survive the switch.How can I help you explore Laravel packages today?